it is in the code above:
with this it works:
ADCON1 = %00000010
Define ADC_BITS 10 ' Set number of bits in result
but not:
ADCON1 = %10000010
Define ADC_BITS 8 ' Set number of bits in result
it is in the code above:
with this it works:
ADCON1 = %00000010
Define ADC_BITS 10 ' Set number of bits in result
but not:
ADCON1 = %10000010
Define ADC_BITS 8 ' Set number of bits in result
Right, with one you're putting the 10 bit value (justified left) into a byte, with the other, you're putting the 10 bit value (justified right) into a byte, trying to stuff 10 bits into a spot for 8 bits.
So, with one, you get the lower 8 bits of the 10 bits, with the other you get the upper 8 bits of the 10 bits.
Which one is it? That's for you to figure out....(hint: if you use a word variable for reading, you'll figure it out quickly if you also use the LCD to display that value)
I am using the same config as the sample program on melabs:
http://www.melabs.com/resources/samples/pbp/adcin8.bas
as you can see mine is not working.
k
Yep its good,
I am just working on reset, so many options, I just want to put zero my values in a push of a button, I think I will just use a pin low pin high, and a loop in my program that verifies this pin.
I read about power on reset, but I never used it and it is unclear in the documentation I read so far.
k
Bookmarks