5 volts if the the chip is running on 5 volts and not changing the reference and using 8 bit resolution will equal 255...
5 volts if the the chip is running on 5 volts and not changing the reference and using 8 bit resolution will equal 255...
Dave
Always wear safety glasses while programming.
Yes I know 5V = 255, but what I was getting at...until I set all the portC pullups disabled (which they should have been at power up anyway), in the absence of an incoming analogue signal, I was geting an ADC reading of 255 (because there was 5V residual on the unconnected pin)...soon as I disable pullups, I got the reading I was expecting ...ie an ADC reading of 0.
This is expected behaviour. Pullups will put 5V on the ADC input. Unless you meant to ask something else.....Yes I know 5V = 255, but what I was getting at...until I set all the portC pullups disabled (which they should have been at power up anyway), in the absence of an incoming analogue signal, I was geting an ADC reading of 255 (because there was 5V residual on the unconnected pin)...soon as I disable pullups, I got the reading I was expecting ...ie an ADC reading of 0.
That's just it - I never asked for or wanted pullups on the ADC pin, so was puzzled when 5V appeared there in the absence of a signal. The datasheet say WPUs are disabled at power up (& my code didn't enable them), so there shouldn't have been 5V on the ADC pin.....what I had to do in the end was disable them myself in my code - even though they should be disabled by default.
In my opinion there's a problem with the PIC16f1828's startup settings vs what Microchip say in their associated datasheet.
Why pay for overpriced toys when you can have
professional grade tools for FREE!!!
For a few minutes I was overwhelmed by the onset of "global community spirit" to do the right thing ...so visited Microchip's website ...they've even produced a video about how to report back silicon errors.....I grew a beard to rival the guitarists in ZZ Top watching it, & then threw my wife's purse at the screen when it got to the bit about "& having followed the 11 steps we've just outlined, unless you attach scope traces we won't believe you & just assume you're a pleb"
I'm now hoping anyone similar 16f1828 problems will find this thread via Google.
Last edited by HankMcSpank; - 16th February 2011 at 14:50.
Bookmarks