Truncated match.
PICList
Thread
'Unable to seperate (2) A/D channels-Help!'
1998\02\20@194348
by
|
Hello!
The following is a snip of a PicBasic program which reads 2 A/D channels
(LTC1298) and is suppose to display them independently on a bargraph. The
problem is when I call for the "test_zero" display, the bargraph will read
either both A/D channels. They are not isolated. When I get the channel 0 A/D
value I copy it
to the "test_zero" register. When I get the channel 1 A/D value I copy it to
the "test_one" register. When I attempt to display channel 1, channel 0 will
also display. I only want to display one A/D result at a time.
Do I need a delay before getting the next channel?
The AD register is 16bit. I only need to display 8 bit so I wrote let
test_zero = AD/16, where test_zero is a 8 bit register. Can I do that?
I am sure I am missing something simple. Please have a
looksee. I have a code snip to not bore you with other details.
main:
gosub GetAD ' Get test0 amd test1 A/D sample
gosub show ' Display fuel sample on bargraph
goto main
show:
let dispVal=test_zero/32 '8 bit result
lookup dispVal,(64,96,112,120,124,126,127,255),bargraph
gosub MaxDisplay
return
GetAD:
let ADch = 0 ' Toggle between input channels.
gosub Convert ' Get data from ADC.
let test_zero = AD/16 ' AD to 8 bit 0-255 and store AD resul
t
let ADch = 1 ' Change input channels.
gosub Convert ' Get data from ADC.
let test_one = AD/16 ' AD to 8 bit 0-255 and store AD result
return
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- Today
- New search...