• AVR Freaks

Hot!controller dsPIC33F family controller

Author
ashvin
New Member
  • Total Posts : 15
  • Reward points : 0
  • Joined: 2019/11/18 03:59:01
  • Location: 0
  • Status: offline
2019/12/15 21:09:26 (permalink)
0

controller dsPIC33F family controller

hello,
i used a controller dsPIC33FJ16GS504 for my project purpose but when i search example code in which i found ADC conversion value is in range from 0 to 1023 (for 10-ADC used) but after completing that they convert data into particular format like Q15 format or Q14 format.
my question is that why used different format like Q15, Q14 and how to converter in this format. please give answer its urgent...
#1

4 Replies Related Threads

    ric
    Super Member
    • Total Posts : 25592
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: controller dsPIC33F family controller 2019/12/15 21:43:16 (permalink)
    0
    You should convert the data into whatever format is useful for YOU!
    You mention nothing about what you want to do with the data, so no-one can give useful advice without guessing what you want to do.
     
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    ashvin
    New Member
    • Total Posts : 15
    • Reward points : 0
    • Joined: 2019/11/18 03:59:01
    • Location: 0
    • Status: offline
    Re: controller dsPIC33F family controller 2019/12/15 22:40:23 (permalink)
    0
    my ADC is 10 bit so its buffer register store value up to 1023
    example,
    an0 = ADCBUF0;    // 10-bits register so value is up to 1023
    but in given code for some application
    they write as below and said that it is a format of Q15
    an0 = ADCBUF0 << 5;
     
    now, my question is that way its called Q15 format and they also convert into Q14 format
    how to converter Q14 format
    example
    an0 is Q15 format as per above example
    now an1 is in Q14 format how its possible..... or why do that way
    an1 = ((ADCBUF1 << 5) - an0);
     
    #3
    du00000001
    Just Some Member
    • Total Posts : 3349
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: online
    Re: controller dsPIC33F family controller 2019/12/16 00:34:13 (permalink)
    0
    @ ashvin
    Seems you skipped some lectures  :(
    https://en.wikipedia.org/wiki/Fixed-point_arithmetic  might help to start understanding Q math.
    But to be honest: seems you're trying to port some AN that you do not understand at all. Correct?

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #4
    ACD
    Starting Member
    • Total Posts : 28
    • Reward points : 0
    • Joined: 2012/04/03 06:44:16
    • Location: United States
    • Status: offline
    Re: controller dsPIC33F family controller 2020/01/18 14:59:11 (permalink)
    0
    I hope you found what you needed in the other responses but if not then:
     
    If you simply want to read an analog signal without any specific realtime need then setup your ADC to use integer format.
    If on the other hand you need to use the ADC in a PID loop then do your math in Q15 format and set the ADC up for  Q15
     
      
    #5
    Jump to:
    © 2020 APG vNext Commercial Version 4.5