Appendix A
64
KEMX-6000 User’s Manual
Appendix A
DIO (Digital I/O) Sample Code
//***************************************************************
//KEMX-6000 DOS DIO sample program
//Please compile with Turbo C 3.0 to utilized the program
//0:Low 1:High
//DI_1: IOport 0x50C bit2 DO_1: IOport 0x539 bit4
//DI_2: IOport 0x50C bit3 DO_2: IOport 0x539 bit5
//DI_3: IOport 0x50C bit4 DO_3: IOport 0x539 bit6
//DI_4: IOport 0x50C bit5 DO_4: IOport 0x53B bit0
//***************************************************************
int main()
{
int RetVal;
//Clear DO_1~4
RetVal=inp(0x539);//IO Port: 0x539
RetVal=(RetVal&0x8F);//DO_1 is bit 4
//DO_2 is bit 5
//DO_3 is bit 6
outp(0x539,RetVal);
RetVal=inp(0x53B);//IO Port: 0x53B
RetVal=(RetVal&0xFE);//DO_4 is bit 0
outp(0x53B,RetVal);