Yes, that should work. Just watch that the math does not over flow the word size var.
Yes, that should work. Just watch that the math does not over flow the word size var.
Dave
Always wear safety glasses while programming.
And if you use an 18F part with PBP2.5 or greater you can do 32 bit math.
http://www.melabs.com/resources/articles/longs.pdf
Dave
Always wear safety glasses while programming.
Can anyone tell me what I am doing wrong? This code just returns " 0 0 " with 3 volts on gpio.0
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
CMCON = 7
ANSEL = %00000001
ADCON0.7 = 1
TRISIO = %00000001
adval var word
ADH var word
ADL var word
over:
pause 1000
ADCIN 0, adval ' Read channel 0 to adval
Serout2 5,16488,[#adval.HighByte," ",#adval.LowByte,13]
goto over
Last edited by n0yox; - 1st April 2020 at 17:58.
I got it fixed it was a hardware issue. Thank you!
Bookmarks