/***************************************************************************** * This sample program will sequentially turn on all bits of the relay input * and sequentially turns them off. Each time it sets a new bit, both the * * relay output and the iso input are read and the data displayed. This * demonstrates how to read and write to a port. */ #include #include #include #include #define TRUE 1 #define FALSE 0 unsigned int base; unsigned AskForBaseAddress(unsigned int OldOne) { char msg[7]; int NewOne = 0, Success = 0, Dummy; int AddrInputPosX, AddrInputPosY; puts("\nPlease enter the Base Address for your card (in hex)"); printf("or press ENTER for %X.\n>", OldOne); AddrInputPosX = wherex(); AddrInputPosY = wherey(); do { gotoxy(AddrInputPosX, AddrInputPosY); clreol(); msg[0] = 5; msg[1] = 0; cgets(msg); sscanf(msg + 2, "%x", &NewOne); Success = 1; Dummy = NewOne; if (msg[1] == 0) { gotoxy(AddrInputPosX, AddrInputPosY); printf("%X", OldOne); Success = 1; Dummy = OldOne; } } while(!Success); return (Dummy); } /* end of AskForBaseAddress */ void printbits(char foo) { int i; for(i=7;i>=0;i--){ if (foo & (1<=0;i--){ if (foo & (1<