pic '877 ADC...PLease HELP !!


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Hi and welcome!
    i see 1 small mistake ADCON1 setting. When you use 10 bit resolution, you have to specify to right justify your results, unless, yeah they might be weird.

    ADCON1 = %10000100

    Now depending of your external impedance the Acquisition/sampling time might be too small. Let's see the worst case... 4MHz, 10K impedance, min acquisition time 11uSec... bah... probably not enough to screw things.

    Sounds like an interesting project so far
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Dec 2007
    Location
    Toronto, Ontario
    Posts
    23


    Did you find this post helpful? Yes | No

    Smile

    hi,

    Thanks alot for your prompt reply mister e ! I will try that code change and see what happens. A few more questions: is any type of pullup/down resistor required on the adc input, or would that cause inaccurate readings ? And according to your calculations, would upping the sample time to 20uSec be better and how do control the input impedance to get the right value? Also, how do I convert my adc "A0" value to volts?

    thanks again,
    BTW, nice snowy winter so far....Eh !

    John

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    nice snowy winter so far....Eh !
    yeah, for once we have it before march

    is any type of pullup/down resistor required on the adc input, or would that cause inaccurate readings ?
    Not really, but depending what is sending you the voltage... the main concern is more the output impedance your sensor show to the adc. It MUST be lower than the maximum recommended in the datasheet. Adding a simple 0.1uF capacitor is also handy to smooth the results.

    And according to your calculations, would upping the sample time to 20uSec be better and how do control the input impedance to get the right value?
    well you're really not as this off. 1uSec is nothing, and you're using the slowest conversion clock, so i wouldn't worry to much about that now.

    Also, how do I convert my adc "A0" value to volts?
    simple maths. 1024=5V
    (ADCResult*5)/1024

    put 512 as adcresults, and woohoo, you have 2.5 v. but yeah, PBP don't work with floating points... so you need some maths again.. Depending of the accuracy you want, you may use a variant of the above. say
    (ADCResult*500)/1024

    512 return 250? 2.50 volt.

    You need to care about the overflow, */ could be used.

    Bellow is a short example of it
    http://www.rentron.com/AD_LOG.htm
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Question

    Hi, Steve

    There's something hurting me in the listing ...

    "
    Quanta CON 1251 ' For 10-bit A/D +Vref = 5V : 5V/1023*256=1.251=Quanta

    "

    shouldn't it be Quanta = 5v/ [b]1024[/b) * 256 ... ???


    That's what all my datasheets tell ... with 5v ref : "code 1023" is 4.99878 v ...

    Alain
    Last edited by Acetronics2; - 21st January 2008 at 16:50.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. 12 bit or higher ADC on a PIC that works with PBP?
    By Brandon in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 11th November 2007, 17:19
  2. Flash PIC with 12 bit ADC
    By Steve_88 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th October 2007, 20:35
  3. ADC -how it works?, pic -
    By matias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 13th March 2007, 21:54
  4. I2C Slave, config Vref - + in pic with ADC
    By sebapostigo in forum PBP Wish List
    Replies: 4
    Last Post: - 5th March 2007, 03:21
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts