Transmitting data – Wavetronix Click 500 (programmable controller) (CLK-500) - Developer Guide User Manual
Page 88
CHAPTER 8 • SERIAL MESSAGE SUPPORT 87
Note
Usually, standard checksums and cyclical redundancy checks (CRCs) are used instead
of creating such a novel checksum. CRCs have a better ability to guarantee that bit
errors of a certain magnitude did not occur.
The sample library code file clickZ1support.lib in the Library\Protocols directory con-
tains the function ClickZ1CalcCRC, which calculates the 8-bit CRC used with Wavetronix
SmartSensor HD. The sample application code file 510.c in the Applications\510 directory
contains the function myCSUMGenerator, which calculates a simple 4-byte checksum as
used by the Wavetronix SmartSensor 105 and SmartSensor Advance.
Transmitting Data
Transmitting data is accomplished using the ClickMsgTransmit function. The ClickMs-
gTransmit function takes a ClickMsgString and a port identifier as its input parameters
and transmits the message on the specified port. The ClickMsgTransmit function returns a
Boolean value indicating success or failure. A failure indicates that the serial communica-
tions system was not able to transmit the message.
ClickMsgTransmit(TimeResponseMsg,V1);
{
if (sum == *expectedCRC)
{
return 0;
}
else
{
return 1;
}
}
else
{
ClickMsgStoreChecksum((char *)(&sum),myCSumIdx);
}
}