//	M570 : Text transmission at the current time every 1 second (event driven)

define port = 4;

function main()
{
	define	dat[8];

	_Cls();
	_PrintF("Send text at the current time every second.\n");
	_BtnOpen(0, "End");

	_ComCreate (port);
	_ComOpen   (port, 115200, 8, 0, 1);
	_TimerStart(1, 1000);
	_Stop();
	_ComDelete (port);
}

function  _OnTimer(tid)
{
	_ComSendText(port, $_StrCat($_DateAndTime(), "\n"));
}

function _OnButton(BtnNo)
{
	_Restart();
}
