chipKIT® Development Platform

Inspired by Arduino™

ADC Questions

Created Tue, 30 Apr 2013 06:16:08 +0000 by orly_andico


Tue, 30 Apr 2013 06:16:08 +0000

Hi all,

I need to read a high-precision encoder which has differential analog outputs.

To wit: Channel A is a voltage between two pins A+ and A- of 1Vpp, centered on 2.5V (hence the absolute value of A+ to GND and A- to GND are both 2.5V to 3.5V)

Same thing for Channel B.

Currently I am using an external differential ADC (Microchip MCP3304) to read these voltages and it works fine. However I was wondering if..

  1. can the Chipkit ADC read a 2.5V to 3.5V range? (given it's a 3.3V part what tricks are needed)

  2. obviously the Chipkit ADC is not differential, so I'd have to read A+ to GND and A- to GND and do some subtraction (and ditto for B+ and B-). How good/bad is the common-mode rejection of the Chipkit ADC?

and is it possible to do a "bulk ADC DMA read" like the STM32 chips do.

Because I'm doing 64X over-sampling, and if I have to read two voltages for each channel (to implement differential operation) that's a lot of voltages to read and I'd rather not use analogRead() if possible.


Tue, 30 Apr 2013 09:36:54 +0000

The internal ADC of the PIC32 chips can read at up to 1Msps and supports DMA transfers.

You will need to configure it manually by directly setting the right SFRs.

Your best bet is to read section 17 and section 31 of the PIC32 Family Reference

For the voltage levels - a simple resistive divider will drop the voltage range for you.

Alternatively you could use an op-amp to convert the differential signal into a single ended signal and reduce the amplitude at the same time.


Tue, 30 Apr 2013 21:11:10 +0000

I checked the datasheet on the ADC because of curiosity (I used the ADC and DMA on a dsPIC33 in the past) and it looks like it has most of the same functionality.

So you don't need to sample A+ and A- separately because you can use them as differential input to the ADC. You can set it up to continuously sample your two channels one after the other without having to do anymore work than check to see if the conversion is finished once you set it up properly. Or wait for the DMA to fill up and work on a buffer full of data.

But as Majenko said, you do have to configure the hardware registers (I don't think there is any abstraction set up for this yet) and you will have to do some form of level-shifting to keep the signal within power rails of the PIC32.

Jacob Christ

Thu, 02 May 2013 17:37:33 +0000

And of course you probably will have to divide down the voltage to prevent saturation of your signal (if your trying to get rid of the amp all together).