Introduction:
The XBee, RS-232, and USB versions of the XRW2G module can be set to World Data Mode by placing a jumper on the internal JP3 header. The jumper must be in place on start-up. In this mode, the XRW2G will transmit a 98 byte data packet over the serial port at user defined intervals. The XBee version transmits the packet using a 2.4GHz 802.15.4 XBee-PRO wireless transceiver. Channel D is used with the default PAN ID. You will need an XBee-PRO or XBee modem to receive data for your application. We manufacture a variety of XBee and XBee-PRO modems.
Data Format:
'#' 0 STX
UNIT ID PREFIX 1 First character (A-Z) for serial number
UNIT ID MSB 2 high byte of sending station ID
UNIT ID LSB 3 low byte of sending station ID
PACKET LENGTH 4 number of byte for packet including STX through CRC
PACKET TYPE 5 type of packet we are sending, 14
SEQUENCE MSB 6
SEQUENCE LSB 7
PULSE_COUNT[0] MSB 8
PULSE_COUNT[0] LSB 9
PULSE_TIME[0] MSB 10
PULSE_TIME[0] LSB 11
PULSE_MIN_TIME[0] MSB 12
PULSE_MIN_TIME[0] LSB 13
PULSE_MAX_TIME[0] MSB 14
PULSE_MAX_TIME[0] LSB 15
PULSE_SUM[0] MSB 16
PULSE_SUM[0] 17
PULSE_SUM[0] 18
PULSE_SUM[0] LSB 19
PULSE_COUNT[1] MSB 20
PULSE_COUNT[1] LSB 21
PULSE_TIME[1] MSB 22
PULSE_TIME[1] LSB 23
PULSE_MIN_TIME[1] MSB 24
PULSE_MIN_TIME[1] LSB 25
PULSE_MAX_TIME[1] MSB 26
PULSE_MAX_TIME[1] LSB 27
PULSE_SUM[1] MSB 28
PULSE_SUM[1] 29
PULSE_SUM[1] 30
PULSE_SUM[1] LSB 31
PULSE_COUNT[2] MSB 32
PULSE_COUNT[2] LSB 33
PULSE_TIME[2] MSB 34
PULSE_TIME[2] LSB 35
PULSE_MIN_TIME[2] MSB 36
PULSE_MIN_TIME[2] LSB 37
PULSE_MAX_TIME[2] MSB 38
PULSE_MAX_TIME[2] MSB 39
PULSE_SUM[2] MSB 40
PULSE_SUM[2] 41
PULSE_SUM[2] 42
PULSE_SUM[2] LSB 43
ANALOG_CURRENT[0] MSB 44
ANALOG_CURRENT[0] LSB 45
ANALOG_AVG[0] MSB 46
ANALOG_AVG[0] LSB 47
ANALOG_STD_DEV[0] MSB 48
ANALOG_STD_DEV[0] LSB 49
ANALOG_CURRENT[1] MSB 50
ANALOG_CURRENT[1] LSB 51
ANALOG_AVG[1] MSB 52
ANALOG_AVG[1] LSB 53
ANALOG_STD_DEV[1] MSB 54
ANALOG_STD_DEV[1] LSB 55
ANALOG_CURRENT[2] MSB 56
ANALOG_CURRENT[2] LSB 57
ANALOG_AVG[2] MSB 58
ANALOG_AVG[2] LSB 59
ANALOG_STD_DEV[2] MSB 60
ANALOG_STD_DEV[2] LSB 61
ANALOG_CURRENT[3] MSB 62
ANALOG_CURRENT[3] LSB 63
ANALOG_AVG[3] MSB 64
ANALOG_AVG[3] LSB 65
ANALOG_STD_DEV[3] MSB 66
ANALOG_STD_DEV[3] LSB 67
ANALOG_CURRENT[4] MSB 68
ANALOG_CURRENT[4] LSB 69
ANALOG_AVG[4] MSB 70
ANALOG_AVG[4] LSB 71
ANALOG_STD_DEV[4] MSB 72
ANALOG_STD_DEV[4] LSB 73
ANALOG_CURRENT[5] MSB 74
ANALOG_CURRENT[5] LSB 75
ANALOG_AVG[5] MSB 76
ANALOG_AVG[5] LSB 77
ANALOG_STD_DEV[5] MSB 78
ANALOG_STD_DEV[5] LSB 79
ANALOG_CURRENT[6] MSB 80
ANALOG_CURRENT[6] LSB 81
ANALOG_AVG[6] MSB 82
ANALOG_AVG[6] LSB 83
ANALOG_STD_DEV[6] MSB 84
ANALOG_STD_DEV[6] LSB 85
ANALOG_CURRENT[7] MSB 86
ANALOG_CURRENT[7] LSB 87
ANALOG_AVG[7] MSB 88
ANALOG_AVG[7] LSB 89
ANALOG_STD_DEV[7] MSB 90
ANALOG_STD_DEV[7] LSB 91
UPTIME_MINUTES MSB 92
UPTIME_MINUTES LSB 93
INTERVAL MS MSB 94
INTERVAL MS LSB 95
CRC MSB 96 high byte of CRC on everything after STX and before CRC
CRC LSB 97 low byte of CRC
Example Code:
C CRC Function
int16 crc_chk(int8 *data, int8 length) {
int8 j;
int16 reg_crc=0xFFFF;
while ( length-- ) {
reg_crc ^= *data++;
for ( j=0 ; j<8 ; j++ ) {
if ( reg_crc & 0x01 ) {
reg_crc=(reg_crc>>1) ^ 0xA001;
} else {
reg_crc=reg_crc>>1;
}
}
}
return reg_crc;
}