BS2pe motherboard
Sean M
Posts: 1
I was using the BS2pe motherboard with a daughter-board attachment. I soldered a pin connector into the A row on the daughter-board which according to the documentation should be port 0 on the motherboard co-processor. I programmed the mother board to execute the following program,
' {$STAMP BS2pe}
' {$PBASIC 2.5}
Owio PIN 10 'of coprocessor A
Voltage VAR Word 'ADC output
Busy VAR Bit 'indicates if the conversion is busy
DO
OWOUT Owio, 0, [noparse][[/noparse]%00011011] 'this selects ADC 0 and the settings
DO:OWIN Owio, 4, [noparse][[/noparse]Busy] :LOOP WHILE Busy 'loops until conversion complete
OWIN Owio, 0, [noparse][[/noparse]Voltage.HIGHBYTE, Voltage.LOWBYTE] 'this takes the value at Owio and places it in Voltage
DEBUG ?Voltage
PAUSE 250
LOOP
This program was meant to output a signal from the ADC using the one-wire protocol but even when I touched the ADC input to ground and power the range would not move from between 300-500 (out of a range of 0-1023). I have not reprogrammed the co-processor with the AVR loader under the assumption that the firmware already installed would convert the ADC value. I even used a second motherboard but got the same result so it could not be broken, I was wondering if there was something that was missed.
' {$STAMP BS2pe}
' {$PBASIC 2.5}
Owio PIN 10 'of coprocessor A
Voltage VAR Word 'ADC output
Busy VAR Bit 'indicates if the conversion is busy
DO
OWOUT Owio, 0, [noparse][[/noparse]%00011011] 'this selects ADC 0 and the settings
DO:OWIN Owio, 4, [noparse][[/noparse]Busy] :LOOP WHILE Busy 'loops until conversion complete
OWIN Owio, 0, [noparse][[/noparse]Voltage.HIGHBYTE, Voltage.LOWBYTE] 'this takes the value at Owio and places it in Voltage
DEBUG ?Voltage
PAUSE 250
LOOP
This program was meant to output a signal from the ADC using the one-wire protocol but even when I touched the ADC input to ground and power the range would not move from between 300-500 (out of a range of 0-1023). I have not reprogrammed the co-processor with the AVR loader under the assumption that the firmware already installed would convert the ADC value. I even used a second motherboard but got the same result so it could not be broken, I was wondering if there was something that was missed.
Comments
Try this code instead:
It's been corrected to read A0, instead of A1. The format for the 10-bit analog read command, as given in the GPIO3 docs is:
····%00pp1011 = $pB
where pp (%00 or %01) is the AVR port number.
-Phil