/* ******************************************************************* This function writes the byte value to the specified port. Valid ports are PORTA, PORTB, PORTCL and PORTCH. *********************************************************************** */ int DOut(int Port, int ByteValue) { int result; int BitData; switch (Port) { case PORTA: result = DBitIn(Port, 4, &BitData); if (BitData == 1) return(3); /* error - not configured for output */ break; case PORTB: result = DBitIn(Port, 1, &BitData); if (BitData == 1) return(3); /* error - not configured for output */ break; case PORTCL: result = DBitIn(Port, 0, &BitData); if (BitData == 1) return(3); /* error - not configured for output */ break; case PORTCH: result = DBitIn(Port, 3, &BitData); if (BitData == 1) return(3); /* error - not configured for output */ break; default: return (0); /* error - illegal port */ break; } outb(ByteValue, Port); /* write the port data */ return(0); /* no errors detected */ }