/******************************************************************************
 xp86_1.c
 
 XP86xx  Digital Input/Output
 This sample program demonstrates higher level DAC output
 function calls.  It will detect XP86xx boards attached to the PLC-bus and
 maximizes the two output channels.

 ******************************************************************************/
 
#use eziocmmn.lib
#use eziobl17.lib		//	this line is needed only for the BL17xx controller
#use ezioplc2.lib

char TITLE[] = "XP86xx DAC Output";

main()
{
	int i;
	unsigned long delayCounter;

	printf("%s\n\n", TITLE);
	plcBusReset();			//	reset the PLCBus
	for (delayCounter = 0x8000; delayCounter--; ) hitwd();	//	delay

	//	locate all possible jumper-set addresses from 0 to 7 and display status
	for (i = 0; i <= 7; ++i) {
		if (plcXP86Init(i)==-1) {				// do a read to locate the board
			printf("Board %d is not located\n\n",i);
			}
		else {
			printf("Board %d is located\n",i);
			plcXP86Out(i*2,0x0fff);
			plcXP86Out(i*2+1,0x0fff);
			}
		printf("\n");
		hitwd();
		}
}
