#use aascz1.lib
//	use the following line if you have a lp31xx
#use eziolp31.lib

main() {
	char testStr[] = "012345678";
	char rBuf[0x100];
	char wBuf[0x100];
	auto char localBuf[0x80];
	auto unsigned count;
	auto struct _Channel *chan;
	
	
	_GLOBAL_INIT();
	on_485();						//	enable transmit
	eioBrdDO(26,0);				//	enable read (to monitor echo)
	chan = aascOpen(DEV_Z1,
		0,
		ASCI_PARAM_8N1+ASCI_PARAM_1200*16,
		NULL);

	aascSetReadBuf(chan,rBuf,sizeof(rBuf));
	aascSetWriteBuf(chan,wBuf,sizeof(wBuf));
	aascTxSwitch(chan,1);
	aascRxSwitch(chan,1);
	
	while (1) {
		hitwd();
		while (!aascWriteBlk(chan,testStr,9,1)) hitwd();
		while (!aascReadBlk(chan,localBuf,9,1)) hitwd();
		localBuf[9] = 0;
		if (strcmp(testStr,localBuf)) exit(1);
	}
}
	
