Joe Dunfee
12-04-2006, 04:01 AM
I am attempting to use the BS2pe motherboard, with its AVR co-processors to read an analog input.· The manual gives this example;
The following example reads the voltage on Port 0, using Vdd as a reference, and returns the entire 10-bit value:
Voltage VA Word
Busy VAR Bit
OWOUT Owio, 0, [%00001011]
DO : OWIN Owio, 4, [Busy] : LOOP WHILE Busy
OWIN Owio, 0, [Voltage.HIGHGYTE, Voltage.LOWBYTE]
However, when I attempt to run this example, the Basic editor says that Owio is an "unidentified symbol."
Reading the Basic Programming manual, I see that the place where the "Owio" is located is the "Pin" field that should be a value from 0 to 15. So, apparently the example in the manual had already assumed the Owio was a variable set to one of these values.· In my case, I will be using AVR co-processor "A", so I am guessing I should set Owio to be zero, and modified the code as follows (I made other changes to get the stamp to loop and output the readings to serial output pin)
' {$STAMP BS2pe}
Voltage VAR Word
Busy VAR Bit
Owio CON 0
Start:
·OWOUT Owio, 0, [%00001011]
·DO : OWIN Owio, 4, [Busy] : LOOP WHILE Busy· '<<<the·Basic programmer says the "WHILE" expected ":" or a "end of line"
·OWIN Owio, 0, [Voltage.HIGHGYTE, Voltage.LOWBYTE]
·DEBUG Voltage.HIGHGYTE, Voltage.LOWBYTE
GOTO Start
It has been quite a while since I have programmed the stamp, and I have never used the OWOUT or OWIN commands before.· I my understanding of the Owio variable correct?· What am I doing wrong?
Thank You in Advance,
Joe Dunfee
The following example reads the voltage on Port 0, using Vdd as a reference, and returns the entire 10-bit value:
Voltage VA Word
Busy VAR Bit
OWOUT Owio, 0, [%00001011]
DO : OWIN Owio, 4, [Busy] : LOOP WHILE Busy
OWIN Owio, 0, [Voltage.HIGHGYTE, Voltage.LOWBYTE]
However, when I attempt to run this example, the Basic editor says that Owio is an "unidentified symbol."
Reading the Basic Programming manual, I see that the place where the "Owio" is located is the "Pin" field that should be a value from 0 to 15. So, apparently the example in the manual had already assumed the Owio was a variable set to one of these values.· In my case, I will be using AVR co-processor "A", so I am guessing I should set Owio to be zero, and modified the code as follows (I made other changes to get the stamp to loop and output the readings to serial output pin)
' {$STAMP BS2pe}
Voltage VAR Word
Busy VAR Bit
Owio CON 0
Start:
·OWOUT Owio, 0, [%00001011]
·DO : OWIN Owio, 4, [Busy] : LOOP WHILE Busy· '<<<the·Basic programmer says the "WHILE" expected ":" or a "end of line"
·OWIN Owio, 0, [Voltage.HIGHGYTE, Voltage.LOWBYTE]
·DEBUG Voltage.HIGHGYTE, Voltage.LOWBYTE
GOTO Start
It has been quite a while since I have programmed the stamp, and I have never used the OWOUT or OWIN commands before.· I my understanding of the Owio variable correct?· What am I doing wrong?
Thank You in Advance,
Joe Dunfee