Confused about setting correct ADC time on 18F2455

Status
Not open for further replies.

riccardo

Member
Hi,

I'm getting a few glitches when I turn a pot connected to an ADC. It seems to occasionally jump to a different value. It's not electrical noise as, I have used bypass caps on the input and also checked with a scope.

I think it must be the way I am configuring the ADC, as I am shamefully not really understanding what the datasheet is telling me there.

My clock is 20MHz, I have a 1k pot between 5V and GND with the wiper pin going to the pic via a 500R resistor.

I don't really get why there is a setting for TAD and FOSC in ADCON2. If I change TAD, do I need to change FOSC too? Table 21-1 in the datasheet, makes me think I should have FOSC/16, but I'm not certain. I don't really know what to set for TAD either.

Can anyone please tell me what the setting should be or point me to a better explanation of how to do it?
 
Hi,

Cannot explain it all to you, but you can get the correct values by using one of the handy pic utility programs - here is one of them I use.
 

Attachments

  • picmulticalc_v_1_3_1.zip
    118.2 KB · Views: 100
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…