Hello folks,
I'm trying to develop a emulator based in the Radio Shack WX200 Weather station protocol http://wx200.planetfall.com/wx200.txt, to but I cannot guess how to do the Unsigned sum of first xx bytes as stated in the specs.
Below is one of my failed attempts (with a fixed string):
I forgot to mention, this project is to be used as "protocol translator" between a Vaisala WXT520 Weather transmitter and the prestigious software http://sandaysoft.com/products/cumulus
Thanks in advance
I'm trying to develop a emulator based in the Radio Shack WX200 Weather station protocol http://wx200.planetfall.com/wx200.txt, to but I cannot guess how to do the Unsigned sum of first xx bytes as stated in the specs.
Below is one of my failed attempts (with a fixed string):
Code:
#picaxe 28x2
#com 3
#terminal 9600
setfreq m8
;***** Symbol definitions *****
symbol SerialOut = a.4 ; Serial port
symbol Led = a.0 ' Running led
Symbol StartPacket = 0xFF ' Start Packet delimiter
Symbol lsd = b10
Symbol msd = b11
Symbol Checksum = b12
symbol FirstDigit = b7
symbol SecondDigit = b8
high Led 'turns on LED
pause 5000 ' Pause 4 seconds
low SerialOut
pause 50
'
do
low led
gosub SentTestPacket
pause 5000 ' Prints hold-on message .
high led
pause 50
loop
SentTestPacket:
Checksum = 0x00
Checksum = Checksum | StartPacket
Checksum = Checksum | 0x02
Checksum = Checksum | 0x81
Checksum = Checksum | 0x71
Checksum = Checksum | 0x00
Checksum = Checksum | 0x87
Checksum = Checksum | 0x05
'Checksum = Checksum | 0xff
'Checksum = Checksum | 0x0c
'Checksum = Checksum | 0x50
'Checksum = Checksum | 0x79
msd = Checksum / 16 + "0" : if msd > "9" then : msd = msd + 7 : end if
lsd = Checksum & $F + "0" : if lsd > "9" then : lsd = lsd + 7 : end if
SerOut SerialOut, N9600, (StartPacket,0x02, 0x81, 0x71, 0x00, 0x87, 0x05, 0xff)
pause 50
return
Thanks in advance