Could someone help with analog resolution while I wait for my new board?
CRST1
Posts: 103
in Propeller 2
While I'm waiting for my replacement board I am trying to get a grip on the analog resolution settings.
I was using the 128 clock 8 bit sampling mode and was getting readings of 0 to 255 at around 1 to 2 volts, don't remember the exact voltages now. With voltages above or below it didn't go any higher or lower.
My interpretation of resolution would mean measuring the complete voltage range with that number of bits. IE: 1 bit would be .01 volt or 1 bit would be .001 volt. It looks like with 8 bit res you cant read the whole voltage range and more bits reads a larger voltage range.
To read from 0 to 3.3 volt do I need to use a larger number of bits. This is what I was trying to figure out when I accidentally touched the wrong pin and ruined my board.
I don't know if I'm stating this correctly.
Is there an explanation of how the resolution works in simple terms somewhere?
Thanks
I was using the 128 clock 8 bit sampling mode and was getting readings of 0 to 255 at around 1 to 2 volts, don't remember the exact voltages now. With voltages above or below it didn't go any higher or lower.
My interpretation of resolution would mean measuring the complete voltage range with that number of bits. IE: 1 bit would be .01 volt or 1 bit would be .001 volt. It looks like with 8 bit res you cant read the whole voltage range and more bits reads a larger voltage range.
To read from 0 to 3.3 volt do I need to use a larger number of bits. This is what I was trying to figure out when I accidentally touched the wrong pin and ruined my board.
I don't know if I'm stating this correctly.
Is there an explanation of how the resolution works in simple terms somewhere?
Thanks
Comments
Edit: I’m also playing with this from the FlexBASIC side of things (making a wrapper for inline assembly) so I’m very interested in this topic.
Set up the adc pins with this: And to read the pins:
Not quite, usually the full scale divides by the number of 1:1 ADC bits.
P2 has full scale a bit outside the rails, so let's call that a nominal 4V span for simplicity, so a 12bit ADC would have a 1mV appx LSB.
Your modes aren't matching the write-up. That ADC pin mode is 100x, which is roughly 50 mV (+-25 mV from VIO/2) full scale. And the smartpin mode is set to 2048 clocks per sample.
EDIT: Here's the mode settings for 5 volts and 128 clocks.
I will try it again when the boards come in.
Thanks