How do I input the 10 bit A/D value, do math on it and use the value in the program or output it to debug?
All the examples I've seen only use 8 bits.
Does it have to be split into 2- 8 bit bytes then ...?
How do I input the 10 bit A/D value, do math on it and use the value in the program or output it to debug?
All the examples I've seen only use 8 bits.
Does it have to be split into 2- 8 bit bytes then ...?
Yup, needs split.
A couple of the hard to find examples.... can be found here
http://www.melabs.com/resources/samples.htm
and here is one on the forum
http://www.picbasic.co.uk/forum/showthread.php?t=11947
Dave
Always wear safety glasses while programming.
You don't need to split it. Just save it in a WORD variable. Yes, the PIC is an 8-bit device, but can easily work on number 16 bits long.
Charles Linquist
Ok so if I read that right I can store the highbyte & lowbyte A/D value in a word variable (adval) then I can do math on the entire 10 bits of the word?
For example:
Code:ADCIN 0, adval ' Read channel 0 to adval adval=adval *2/10 'do math on 10 bit adval Debug "A/D Value: ",dec adval,10,13 'Send decimal value out
Yes, that should work. Just watch that the math does not over flow the word size var.
Dave
Always wear safety glasses while programming.
Bookmarks