beautypg.com

Wavetronix Click 500 (programmable controller) (CLK-500) - Developer Guide User Manual

Page 90

background image

CHAPTER 8 • SERIAL MESSAGE SUPPORT 89

Note

If you create a variable for a message field such as a destination address, and the
received destination address does not match, you will need to filter that out in the
callback function. To prevent execution of the callback function in this case, you may
want to consider creating the ClickMsgString object with a literal destination address.

The system passes the received message virtual port identifier to the callback function. The

callback does not return any error status.

The Click 500 message library provides the following two methods for removing messages

from the message watch list, neither of which returns an error status:

˽

ClickMsgRemoveReceiveTask – Removes a single message from the receive task list.

˽

ClickMsgRemoveAllReceiveTask – Clears all messages from the receive task list.

TimeResponseMsg = ClickMsgCreate(“ “hh:mm:ss.ms |xsum\r\n”\
“%2d[month2]/%2d[day2]/%4d[year2] “\
“%2d[hour2]:%2d[minute2]:%2d[sec2]”\
“.%3d[ms2]|%1CSUM[0]\r\n>”);

////////////////////////////////////////////////////////////
// To set the time send a message such as:
// “SETTIME 07/21/2009 16:01:02.999|:\r”
// MM/DD/YYYY hh:mm:ss.ms
////////////////////////////////////////////////////////////
TimeRequestMsg = ClickMsgCreate(“ “%2d[month1]/%2d[day1]/%4d[year1] “\
“%2d[hour1]:%2d[minute1]:%2d[sec1]”\
“.%3d[ms1]|%1CSUM[0]\r>”);

ClickMsgAddChecksumTask(DateChecksum,0);

ClickMsgAddReceiveTaskToVPort(TimeRequestMsg,
SetTime,V1);
}