It looks OK to me (except the Next which is orphan! Needs the variable to increase), but sure only testing will prove this.
A couple of improovments:
Since the chip you intent to use has UART why not use the HSEROUT command instead SEROUT2?
Like this
HSEROUT [bytevar str\4]
Also I don't quite understand why do you use the
byteVar[channel] = adcVar[channel] /4
If you want to convert the 10-bit ADC result just type this:
byteVar[channel] = adcVar[channel] >>2
and the 10-bit result will be converted to 8-bit.
Even better use the DEFINE to set ADC to 8 bits.
So it might be like that:
main:
' read all channels of the accelerometer:
for channel = 0 to 3 ' read the two accelerometers from pin 0 - 3
ADCIN channel, bytevar[channel]
pause 1
next channel
' send results out the serial port:
Hserout [byteVar str\4]
GoTo main
Ioannis
Bookmarks