johnp
April 13th, 2007, 03:44 AM
Hi All,
I am using Girder 3.3 and ran into a device I can't quite figure out how to deal with.
It's a Compool swimming pool / spa controller.
The part that has me stuck is that in the data coming in from the device, it does not have a termination string like most protocols, instead it has a pair of sync bytes at the front of the string. The serial plugin does not have a built in way of dealing with this, so I have to somehow process the strings one byte at a time and reformat them into a status word that I can parse and process.
To make things a little more complicated it has two different word lengths, 23 bytes for normal status and 8 bytes for NACKs / ACKs
The Status Packet is formatted as follows:
Byte 0 SYNC BYTE 0 0xFFh (always)
Byte 1 SYNC BYTE 1 0xAAh (always)
Byte 2 Destination Address 0x0Fh (always)
Byte 3 LX3xxx Version 0x??h (see definitions)
Byte 4 OpCode 0x02h (always)
Byte 5 Info Field Length 0x10h (always)
Byte 6 Minutes 0x00h - 0x3Bh (see definitions)
Byte 7 Hours 0x00h - 0x17h (see definitions)
Byte 8 Primary Equipment 0x??h (see definitions)
Byte 9 Secondary Equipment 0x??h (see defiintions)
Byte 10 Delay/Heat Source 0x??h (see definitions)
Byte 11 Water Temperature 0x??h (see definitions)
Byte 12 Solar Temperature 0x??h (see definitions)
Byte 13 Spa Water Temp 0x??h (3830 only - see definitions)
Byte 14 Spa Solar Temp 0x??h (3830 only - see definitions)
Byte 15 Desired Pool Temp 0x??h (see definitions)
Byte 16 Desired Spa Temp 0x??h (see definitions)
Byte 17 Air Temperature 0x??h (see definitions)
Byte 18 Spare/Future Use 0x??h (see definitions)
Byte 19 Spare/Future Use 0x??h (see definitions)
Byte 20 Equip/Sensor Stat 0x??h (see definitions)
Byte 21 Product Type/Stat 0x??h (see definitions)
Byte 22 Hi Byte of Checksum 0x??h (see definitions)
Byte 23 Lo Byte of Checksum 0x??h (see definitions)
The ACK / NACK Packets looks like this:
ACK Packet:
.................................................. .
Byte 0 SYNC BYTE 0 0xFFh (always)
Byte 1 SYNC BYTE 1 0xAAh (always)
Byte 2 Destination Address 0x01h (always)
Byte 3 LX3xxx Version 0x??h (see definitions)
Byte 4 OpCode (ACK) 0x01h (always)
Byte 5 Info Field Length 0x01h (always)
Byte 6 Packet type ACK'd 0x82h (always)
Byte 7 Hi Byte of Checksum 0x??h (see definitions)
Byte 8 Lo Byte of Checksum 0x??h (see definitions)
NACK Packet:
..................................................
Byte 0 SYNC BYTE 0 0xFFh (always)
Byte 1 SYNC BYTE 1 0xAAh (always)
Byte 2 Destination Address 0x0Fh (always)
Byte 3 LX3xxx Version 0x??h (see definitions)
Byte 4 OpCode (NACK) 0x00h (always)
Byte 5 Info Field Length 0x01h (always)
Byte 6 NACK data 0xFFh (always)
Byte 7 Hi Byte of Checksum 0x??h (see definitions)
Byte 8 Lo Byte of Checksum 0x??h (see definitions)
So I need to figure out how to compile the data in a format that I can process the rest of the information.
I'm sure LUA can do this pretty easily, but I am just not that advanced of a user.
Thanks in advance for any help.
I am using Girder 3.3 and ran into a device I can't quite figure out how to deal with.
It's a Compool swimming pool / spa controller.
The part that has me stuck is that in the data coming in from the device, it does not have a termination string like most protocols, instead it has a pair of sync bytes at the front of the string. The serial plugin does not have a built in way of dealing with this, so I have to somehow process the strings one byte at a time and reformat them into a status word that I can parse and process.
To make things a little more complicated it has two different word lengths, 23 bytes for normal status and 8 bytes for NACKs / ACKs
The Status Packet is formatted as follows:
Byte 0 SYNC BYTE 0 0xFFh (always)
Byte 1 SYNC BYTE 1 0xAAh (always)
Byte 2 Destination Address 0x0Fh (always)
Byte 3 LX3xxx Version 0x??h (see definitions)
Byte 4 OpCode 0x02h (always)
Byte 5 Info Field Length 0x10h (always)
Byte 6 Minutes 0x00h - 0x3Bh (see definitions)
Byte 7 Hours 0x00h - 0x17h (see definitions)
Byte 8 Primary Equipment 0x??h (see definitions)
Byte 9 Secondary Equipment 0x??h (see defiintions)
Byte 10 Delay/Heat Source 0x??h (see definitions)
Byte 11 Water Temperature 0x??h (see definitions)
Byte 12 Solar Temperature 0x??h (see definitions)
Byte 13 Spa Water Temp 0x??h (3830 only - see definitions)
Byte 14 Spa Solar Temp 0x??h (3830 only - see definitions)
Byte 15 Desired Pool Temp 0x??h (see definitions)
Byte 16 Desired Spa Temp 0x??h (see definitions)
Byte 17 Air Temperature 0x??h (see definitions)
Byte 18 Spare/Future Use 0x??h (see definitions)
Byte 19 Spare/Future Use 0x??h (see definitions)
Byte 20 Equip/Sensor Stat 0x??h (see definitions)
Byte 21 Product Type/Stat 0x??h (see definitions)
Byte 22 Hi Byte of Checksum 0x??h (see definitions)
Byte 23 Lo Byte of Checksum 0x??h (see definitions)
The ACK / NACK Packets looks like this:
ACK Packet:
.................................................. .
Byte 0 SYNC BYTE 0 0xFFh (always)
Byte 1 SYNC BYTE 1 0xAAh (always)
Byte 2 Destination Address 0x01h (always)
Byte 3 LX3xxx Version 0x??h (see definitions)
Byte 4 OpCode (ACK) 0x01h (always)
Byte 5 Info Field Length 0x01h (always)
Byte 6 Packet type ACK'd 0x82h (always)
Byte 7 Hi Byte of Checksum 0x??h (see definitions)
Byte 8 Lo Byte of Checksum 0x??h (see definitions)
NACK Packet:
..................................................
Byte 0 SYNC BYTE 0 0xFFh (always)
Byte 1 SYNC BYTE 1 0xAAh (always)
Byte 2 Destination Address 0x0Fh (always)
Byte 3 LX3xxx Version 0x??h (see definitions)
Byte 4 OpCode (NACK) 0x00h (always)
Byte 5 Info Field Length 0x01h (always)
Byte 6 NACK data 0xFFh (always)
Byte 7 Hi Byte of Checksum 0x??h (see definitions)
Byte 8 Lo Byte of Checksum 0x??h (see definitions)
So I need to figure out how to compile the data in a format that I can process the rest of the information.
I'm sure LUA can do this pretty easily, but I am just not that advanced of a user.
Thanks in advance for any help.