Analog Input on BS2pe w/28301 daughterboard
maxsmart
Posts: 4
How do you perform analog input on the bs2pe?· I have the 28301 daughterboard, which I think is required, and a LM34 temperature sensor.· How do I take a reading from the LM34?· What pin do I connect it to?· A0,A1,A2,A3?· Did I even need the 28301 daughterboard (the I/O daughterboard)?· I have been told I need to use something called the AVR, but that doesn't seem to be mentioned anywhere in the programming manual.·
Comments
A: See the documentation for the GPIO3 coprocessor firmware, which is preinstalled on the MoBo.
Q: How do I take a reading from the LM34?
A: Connect V+ to Vdd, Gnd to Vss, and Vout to the coprocessor input.
Q: What pin do I connect it to? A0,A1,A2,A3?
A: Either A0 or A1.
Q: Did I even need the 28301 daughterboard (the I/O daughterboard)?
A: No. You could have used the Proto-DB, which is less expensive and provides holes to solder the sensor into. (I don't recommend poking component leads directly into the daughterboard sockets, though.)
Q: I have been told I need to use something called the AVR, but that doesn't seem to be mentioned anywhere in the programming manual.
A: The PBASIC manual does not cover AVR programming. The AVR firmware driver docs are listed with their respective daughterboards. But the default GPIO3 is what you want to use.
-Phil
Here is my function, GetReading:
GetReading:
OWOUT Owio, 0, [noparse][[/noparse]%00001011]
DO
OWIN Owio, 4, [noparse][[/noparse]Busy]
LOOP WHILE Busy
OWIN Owio, 0, [noparse][[/noparse]Voltage.HIGHBYTE, Voltage.LOWBYTE]
DEBUG DEC Voltage
RETURN
When I run this function repeatedly in a loop, the value bounces around a bit then settles on Voltage=390. I change the test voltage to 0v (ground) and the reading remains the same. What am I doing wrong? Thanks!
Please list your entire program between [noparse][[/noparse]code] and [noparse][[/noparse]/code] tags.
-Phil
-Phil