/* RTSDTR.C For test functions: (1) SetDtrInactive(); (2) SetDtrActive(); (3) SetRtsInactive(); (4) SetRtsActive(); DTR bit: bit 0 of MCR RTS bit: bit 1 of MCR DTR pin of COM1 (pin 4) RTS pin of COM1 (pin 7) when 7188 is reset or set to Inactive mode: DTR and RTS bits is reset to 0 /DTR and /RTS pin of 16C550 is reset to 5V DTR(4) and RTS(7) pin of COM1 is reset to about -8V When set to Active mode: DTR and RTS bits is reset to 1 /DTR and /RTS pin of 16C550 is reset to 0V DTR(4) and RTS(7) pin of COM1 is reset to about +8V */ #include #include #include"..\lib\7188.h" main() { int data; data=inp(0x204); printf("data=%x Current DTR bit is %s\n\r",data&3,data&1 ? "High":"Low"); SetDtrInactive(); printf("Current DTR(pin 4) is Inactive(=-8V)\n\r"); data=inp(0x204); printf("data=%x Current DTR bit is %s\n\r",data&3,data&1 ? "High":"Low"); getch4(); SetDtrActive(); printf("Current DTR(pin 4) is Active(=+8V)\n\r"); data=inp(0x204); printf("data=%x Current DTR bit is %s\n\r",data&3,data&1 ? "High":"Low"); getch4(); SetDtrInactive(); printf("Current DTR(pin 4) is Inactive(=-8V)\n\r"); data=inp(0x204); printf("data=%x Current DTR bit is %s\n\r",data&3,data&1 ? "High":"Low"); getch4(); SetRtsInactive(); printf("Current RTS(pin 7) is Inactive(=-8V)\n\r"); data=inp(0x204); printf("data=%x Current RTS bit is %s\n\r",data&3,data&2 ? "High":"Low"); getch4(); SetRtsActive(); printf("Current RTS(pin 7) is Active(=+8V)\n\r"); data=inp(0x204); printf("data=%x Current RTS bit is %s\n\r",data&3,data&2 ? "High":"Low"); getch4(); SetRtsInactive(); printf("Current RTS(pin 7) is Inactive(=-8V)\n\r"); data=inp(0x204); printf("data=%x Current RTS bit is %s\n\r",data&3,data&2 ? "High":"Low"); }