User`s manual

Watlow Controls Communications Guide 21
922Comm Diagnostic
Software
Another program available free of charge
is called “922COMM.EXE" which is used
with the Series 922 Controller. This can be
downloaded from our BBS at 507-452-
3958. This is a terminal program that
handles the protocol for you. The
program can be used to determine if your
cables are properly connected and that the
controller is working. This program
supports the ANSI x3.28 and XON/XOFF
protocols.
Comm4 Diagnostic Software
The “COMM4.EXE” program can be
downloaded free of charge from our BBS at
507-452-3958. This is a terminal program
which handles the protocol for you. The
program can be used to determine if your
cables are properly connected and that the
controller is working. This program
supports the ANSI x3.28 and XON/XOFF
protocols.
Comm5vb Diagnostic
Software
The “COMM5VB.EXE” program can be
downloaded free of charge from our BBS at
507-452-3958. This is a terminal program
that handles the protocol for you. The
program can be used to determine if your
cables are properly connected and that the
controller is working. This program
supports the Modbus, ANSI x3.28 and
XON/XOFF protocols.
CRC
Cyclical Redundancy Checksum (CRC)
Algorithm
This C routine, calc_crc(), calculates the
cyclical redundancy checksum, CRC, for a
string of characters. The CRC is the result
of dividing the string by 0xA001. Modbus
applications calculate the packet’s CRC
then append it to the packet.
#define POLYNOMIAL 0xA001;
unsigned int calc_crc(unsigned char
*start_of_packet, unsigned char
*end_of_packet)
{
unsigned int crc;
unsigned char bit_count;
unsigned char *char_ptr;
/* Start at the beginning of the packet */
char_ptr = start_of_packet;
/* Initialize CRC */
crc = 0xffff;
/* Loop through the entire packet */
do{
/* Exclusive-OR the byte with the CRC */
crc ^= (unsigned int)*char_ptr;
/* Loop through all 8 data bits */
bit_count = 0;
do{
/* If the LSB is 1, shift the CRC and XOR
the polynomial mask with the CRC */
if(crc & 0x0001){
crc >>= 1;
crc ^= POLYNOMIAL;
}
/* If the LSB is 0, shift the CRC only */
else{
crc >>= 1;
}
} while(bit_count++ < 7);
} while(char_ptr++ < end_of_packet);
return(crc);
}