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
2017/12/07 03:30:15 (permalink)
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
#1

6 Replies Related Threads

    Unis
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2017/05/05 02:02:46
    • Location: 0
    • Status: offline
    Re: 12-bit ADC on dsPIC33F - Output format 2017/12/07 06:12:25 (permalink)
    0
    I just found it myself: the differential ADC is unipolar. So I can't get negative values.
     
    Daniel
    #2
    du00000001
    Just Some Member
    • Total Posts : 1434
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: 12-bit ADC on dsPIC33F - Output format 2017/12/07 06:18:20 (permalink)
    0
    Have you set the DIFFx bit?
    If I had to guess: no LoL

    Most times the bug is in front of the keyboard.
    #3
    Unis
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2017/05/05 02:02:46
    • Location: 0
    • Status: offline
    Re: 12-bit ADC on dsPIC33F - Output format 2017/12/07 06:24:36 (permalink)
    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
    #4
    du00000001
    Just Some Member
    • Total Posts : 1434
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: 12-bit ADC on dsPIC33F - Output format 2017/12/07 08:02:56 (permalink)
    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".

    Most times the bug is in front of the keyboard.
    #5
    Unis
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2017/05/05 02:02:46
    • Location: 0
    • Status: offline
    Re: 12-bit ADC on dsPIC33F - Output format 2017/12/07 08:08:33 (permalink)
    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
    #6
    du00000001
    Just Some Member
    • Total Posts : 1434
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: 12-bit ADC on dsPIC33F - Output format 2017/12/07 08:45:43 (permalink)
    0
    Don't mind!
    This is a very big family with vastly differing features - especially regarding ADCs.
    It is best to give the exact part designation, but at least the letter pairs giving away the subfamily and the "special features".

    Most times the bug is in front of the keyboard.
    #7
    Jump to:
    © 2017 APG vNext Commercial Version 4.5