//	M560 : Eight sine waves with different phases are displayed
option double;

define	t	 = 0;

function main()
{
	define	dat[8];

	_Cls();
	_PrintF("Eight sine waves with different phases are displayed\n");

	_TmcOpen("Eight sine wave display");
	_TmcSetItems(8);
	_TimerStart(1, 100);

	_Stop();

	_TmcClose();

}

//	Timer procedure
function  _OnTimer(tid)
{
	define	i, dt;
	define	dat[8];

	if (tid == 1) {	//	Timer-1?
		for (i = 0, dt = 0; i < 8; i++, dt += 5) {
			dat[i] = _Sin(t + dt);
		}
		_TmcPutData(dat[]);
		t += 1.0;
	}
}

//	Processing when chart window closes
function  _OnTmcClose()
{
	_Restart();
}
