Decoding serial port data
Posted on 2006-03-27
A bit of a tricky one this (for me anyway).
I am reading data from a weather station through the serial port which is arriving as a string of characters.
I need to be able to decode this data but have no idea where to start as there is no official instructions. I managed to dig up some help but I have no idea what the heck they are talking about, hence my post.
Their instructions are:
Data is sent simplex from the weather station via an RS 232 interface to the PC
The frame format is as follows, the length being implied by the Code value:
Start Start Code Channel Data Checksum
Code 0x00 - 0x0F
Channel 0x00 in most cases, but with specific uses as follows:
The first hex digit indicates the battery status (where relevant). The second hex digit indicates the channel number (where relevant).
For the Clock Minute message this byte indicates the number of minutes.
Add all bytes arithmetically, including the Code byte but excluding the Start bytes and the Checksum byte. Subtract 2 and take the bottom 7 bits to get the correct checksum.
Numbers are represented in BCD, except for ambient pressure which is in binary. The digits come in a variety of orders. The topmost quartet is set to 0x8 for a negative number (temperature, wind chill). For example:
0x18 - 18 as an hour (6 PM)
0x1703 - 31.7 degrees as a temperature
0x3582 -23.5 degrees as a temperature
0x8015 -15 degrees as a wind chill.
Does anyone have any idea what they are talking about?