• Forums
• Posts
Latest Posts
Active Posts
Recently Visited
Search Results
• Page Extras
• Forum Themes

### Hot!12-bit ADC on dsPIC33F - Output format

Author
Unis
New Member
• Total Posts : 4
• Reward points : 0
• Joined: 2017/05/05 02:02:46
• Location: 0
• Status: offline
0

# 12-bit ADC on dsPIC33F - Output format

Hello
I successfully use the channel 0 of the 12bit-ADC on a dsPIC33F. It is configured in differential mode such that AN2 is its positive input (CH0SA = 2), and AN1 is its negative input (CH0NA = 1).
That works fine as long as the output format FORM = 0 (unsigned integer). As the voltage difference may get negative, I tried using FORM = 1 (signed integer), but then the value gets completely wrong.
If I use FORM = 1 and read channels AN1 and AN2 individually (with CH0NA = 0), that works fine though. It seems as if the calculation inside the ADC gets something wrong.

Has somebody used differential mode successfully with FORM = 1? Or can somebody tell me whether that is impossible?

Is there something wrong with my understanding of 'differential' mode of the ADC?

Thanks and kind regards
Daniel

Here are some results with FORM = 1, CH0NA = 1, Vcc = 2.8V, :

Voltage @ AN1 = 1.02V and voltage @ AN2 = 1.65V:
Result        Expected
-1160        + 920

Voltage @ AN1 = 0.75V and voltage @ AN2 = 1.92
Result        Expected
-375          + 1711

Voltage @ AN1 = 0.4V and voltage @ AN2 = 2.7
Result        Expected
+627         + 3364

Unis
New Member
• Total Posts : 4
• Reward points : 0
• Joined: 2017/05/05 02:02:46
• Location: 0
• Status: offline
0
I just found it myself: the differential ADC is unipolar. So I can't get negative values.

Daniel
du00000001
Just Some Member
• Total Posts : 1954
• Reward points : 0
• Joined: 2016/05/03 13:52:42
• Location: Germany
• Status: offline
0
Have you set the DIFFx bit?
If I had to guess: no

PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
Unis
New Member
• Total Posts : 4
• Reward points : 0
• Joined: 2017/05/05 02:02:46
• Location: 0
• Status: offline
0
Hi du00.....1

are you sure DIFFx exists in dsPIC33F? It doesn't seem to be mentioned in my datasheet, neither in the FRM.

Actually I already answered to my question myself. Being a newbie, my response still waits for approval.

Thanks
Daniel
du00000001
Just Some Member
• Total Posts : 1954
• Reward points : 0
• Joined: 2016/05/03 13:52:42
• Location: Germany
• Status: offline
0
Are you aware that you didn't give us your exact derivative ?
My "wisdom" is from the datasheet of the dsPIC33EPXXXGS70X/80X FAMILY, which obviously supports such "tricks".

PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
Unis
New Member
• Total Posts : 4
• Reward points : 0
• Joined: 2017/05/05 02:02:46
• Location: 0
• Status: offline
0
The family dsPIC33F is mentioned in the title of my thread. I thought the registers are the same for the whole family. Sorry if that's not the case.
Daniel
du00000001
Just Some Member
• Total Posts : 1954
• Reward points : 0
• Joined: 2016/05/03 13:52:42
• Location: Germany
• Status: offline