Trying to programme an 08M to read a varying adc input using readadc10 four times at 0.5 second intervals and if the value at each reading <778 (which corresponds to a particular voltage) place it in a variable, eg b1 b2 b3 b4, for each reading. After the 4th reading, if the sum of the variables b1 to b4 = 3112 (778x4) then go to another routine. I'm trying to ascertain when the varying input becomes constant for 2 sec. My programme reads,
main:
readadc10 2,b1 'read value on pin 2 into variable b1'
if b1<778 then check1 'if b1 less than 778 then go to check1
if b1,b2,b3,b4 = 3112 then wakeup 'if the sum of variables b1- 'b4 = 3112 then go to wakeup
check1:
pause 500
readadc10 2,b2
if b2<778 then check2
check2:
pause 500
readadc10 2,b3
if b3<778 then check3
check3:
pause 500
readadc10 2,b4
if b4<778 then return
The syntax checker reports an error on the 3rd line in main. I've tried changing this line to read "if b1+b2+b3+b4 = 3112 then wakeup" but the error is still there. Note- wakeup routine not listed
Is it correct to assume rapid readings of the same adc input can be placed in different variables? If, so how can these variables be added?
main:
readadc10 2,b1 'read value on pin 2 into variable b1'
if b1<778 then check1 'if b1 less than 778 then go to check1
if b1,b2,b3,b4 = 3112 then wakeup 'if the sum of variables b1- 'b4 = 3112 then go to wakeup
check1:
pause 500
readadc10 2,b2
if b2<778 then check2
check2:
pause 500
readadc10 2,b3
if b3<778 then check3
check3:
pause 500
readadc10 2,b4
if b4<778 then return
The syntax checker reports an error on the 3rd line in main. I've tried changing this line to read "if b1+b2+b3+b4 = 3112 then wakeup" but the error is still there. Note- wakeup routine not listed
Is it correct to assume rapid readings of the same adc input can be placed in different variables? If, so how can these variables be added?