Need Help with ADC code
SN96
Posts: 318
Hello guys,
I have developed a sound sensing circuit board that works fantastic but I am having problems getting the code to·read both channels properly. It outputs to the debug window the values of the channels·properly, however I am not able to put those values in to a variable. One variable seems to have the right value while the other variable has some other value.
Here is a screenshot of the debug output:
For single ended, I want to be able to put the 3 digit value of channel 0 and channel 1 in to variables "LeftEar" and "RightEar" so I can do something like this:
IF RightEar > 120 then GOSUB MoveRightServo
IF LeftEar > 120 then GOSUB MoveLeftServo
Thanks for any help at all.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
Post Edited (SN96) : 2/19/2006 10:06:15 PM GMT
I have developed a sound sensing circuit board that works fantastic but I am having problems getting the code to·read both channels properly. It outputs to the debug window the values of the channels·properly, however I am not able to put those values in to a variable. One variable seems to have the right value while the other variable has some other value.
Main: DO sglDif = Sgl FOR oddSign = 0 TO 1 GOSUB Read_0832 mVolts(oddSign) = adc(oddSign) */ Raw2mV DEBUG CRSRXY, 7, (4 + oddSign), DEC3 adc(oddSign), TAB, DEC mVolts(oddSign) DIG 3, ".", DEC3 mVolts(oddSign) NEXT RightEar = adc(1) LeftEar = adc(0) IF RightEar > 120 THEN GOSUB RightEarSub IF LeftEar > 120 THEN ' this has some other value different from debug window. GOSUB LeftEarSub ENDIF ENDIF LOOP
Here is a screenshot of the debug output:
For single ended, I want to be able to put the 3 digit value of channel 0 and channel 1 in to variables "LeftEar" and "RightEar" so I can do something like this:
IF RightEar > 120 then GOSUB MoveRightServo
IF LeftEar > 120 then GOSUB MoveLeftServo
Thanks for any help at all.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
Post Edited (SN96) : 2/19/2006 10:06:15 PM GMT
Comments
··········· RightEar = adc(1)
··········· LeftEar· = adc(0)
But you don't tell it what adc(0) or adc(1) are equal to.
So...
Post Edited (PJ Allen) : 2/19/2006 10:37:24 PM GMT
Thanks anyway PJ.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
·