I've constructed a pair of 434 Mhz TX/RX units based upon Stan Swan's Silicon Chip article Jan 06.
Worked like a dream as designed to transmit temperature integer values using the readtemp instruction.
Based upon the success of that I then wanted to calculate & transmit the temperature to 4 decimal points
so I started using the readtemp12 instruction but I'm receive the incorrect temperature values at the far end.
To simplify fault finding I unplugged the RF modules and made a connection between units using 2 wires.
The TRANSMITTER code below has been stripped of the usual serout 4,n300,(85,85,85,85,"ABC",b1) preamble used with the Tx/RX modules
The TRANSMITTER code works fine and looks good in debug and I can actually see with an external terminal program the valid data typically in the form "Temp = 23.1250" but at the RECEIVER the data out of the serin instruction (as seen in debug into b1) is incorrect. The serin is also stripped in this example of the usual (85,85,85,85,"ABC",b1) preamble.
What is wrong with my implimentation of serin ??? this is the second line of the receiver code and it's output is incorrect in debug. The output code receiver is something like "Temp = 85"
Any ideas .............
' TRANSMITTER CODE
'Picaxe-08M based upon 434MHz Tx/Rx data units. Ver 1.0 11/05 for Jan.'06 SiChip
tx: ' 434MHz UHF transmitter & DS18B20 temp reading routine
high 2 ' turn on DS18B20 temp sensor
wait 1 ' settling time pre temp reading
readtemp12 1,w1 ' direct Celsius value returned
w2 = w1 / 16 ' Integer part
w3 = w1 & %0001 MAX 1 * 0625
w3 = w1 & %0010 MAX 1 * 1250 + w3
w3 = w1 & %0100 MAX 1 * 2500 + w3
w3 = w1 & %1000 MAX 1 * 5000 + w3
debug
SERTXD("Te = ",#w2,"." ' send interger part to local programming cable followed by "."
serout 4,n300,("Temp = ",#w2,"."
SERTXD(#w3,CR,LF) 'send decimal part
serout 4,n300,(#w3,CR,LF)
PAUSE 1
pulsout 0,200 ' red LED winks as data sent
sleep 1 ' power down (adjust to suit SLEEP units 2.3 sec)
goto tx ' loop to send more data
===================================================================
'RECEIVER CODE
rx: 'receiving routine
serin 3,N300,b1 'awaits b1 data without any qualify preceeding
'debug
pulsout 1,200 'green LED winks- doubled if both TX & repeater received!
sertxd("Temp = " ,#b1," " 'simple F8 display of Celsius temp.Easily extended-Excel?
pause 500
serout 0,n300,("temp is ",#b1," ",13,10)
pause 500
goto rx 'loop to await next data arrival
Worked like a dream as designed to transmit temperature integer values using the readtemp instruction.
Based upon the success of that I then wanted to calculate & transmit the temperature to 4 decimal points
so I started using the readtemp12 instruction but I'm receive the incorrect temperature values at the far end.
To simplify fault finding I unplugged the RF modules and made a connection between units using 2 wires.
The TRANSMITTER code below has been stripped of the usual serout 4,n300,(85,85,85,85,"ABC",b1) preamble used with the Tx/RX modules
The TRANSMITTER code works fine and looks good in debug and I can actually see with an external terminal program the valid data typically in the form "Temp = 23.1250" but at the RECEIVER the data out of the serin instruction (as seen in debug into b1) is incorrect. The serin is also stripped in this example of the usual (85,85,85,85,"ABC",b1) preamble.
What is wrong with my implimentation of serin ??? this is the second line of the receiver code and it's output is incorrect in debug. The output code receiver is something like "Temp = 85"
Any ideas .............
' TRANSMITTER CODE
'Picaxe-08M based upon 434MHz Tx/Rx data units. Ver 1.0 11/05 for Jan.'06 SiChip
tx: ' 434MHz UHF transmitter & DS18B20 temp reading routine
high 2 ' turn on DS18B20 temp sensor
wait 1 ' settling time pre temp reading
readtemp12 1,w1 ' direct Celsius value returned
w2 = w1 / 16 ' Integer part
w3 = w1 & %0001 MAX 1 * 0625
w3 = w1 & %0010 MAX 1 * 1250 + w3
w3 = w1 & %0100 MAX 1 * 2500 + w3
w3 = w1 & %1000 MAX 1 * 5000 + w3
debug
SERTXD("Te = ",#w2,"." ' send interger part to local programming cable followed by "."
serout 4,n300,("Temp = ",#w2,"."
SERTXD(#w3,CR,LF) 'send decimal part
serout 4,n300,(#w3,CR,LF)
PAUSE 1
pulsout 0,200 ' red LED winks as data sent
sleep 1 ' power down (adjust to suit SLEEP units 2.3 sec)
goto tx ' loop to send more data
===================================================================
'RECEIVER CODE
rx: 'receiving routine
serin 3,N300,b1 'awaits b1 data without any qualify preceeding
'debug
pulsout 1,200 'green LED winks- doubled if both TX & repeater received!
sertxd("Temp = " ,#b1," " 'simple F8 display of Celsius temp.Easily extended-Excel?
pause 500
serout 0,n300,("temp is ",#b1," ",13,10)
pause 500
goto rx 'loop to await next data arrival