beautypg.com

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

Page 94

background image

CHAPTER 8 • SERIAL MESSAGE SUPPORT 93

ClickMsgString TimeRequestMsg;

void main(void)
{
ClickMenuAddMode(Mode1, Setup1, BLUE, 0, 0);
ClickMenuStart();
}

void Mode1(void)
{
if (ClickBtnPressed())
{
BuildTimeResponseMsg();
ClickMsgTransmit(TimeResponseMsg,V1);
}
}

void Setup1(void)
{

ClickSerialPortDisconnectAll();

ClickSerialPortConnect(V1, _485TOP);
//ClickSerialPortConnect(V1, _232FRONT);
ClickSerialPortConfigureVirtual(V1, 9600, DATABIT_8,
PARITY_N);

ClickMsgRemoveAllReceiveTask();

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] “\