// // Data Slicer Demo, mycal labs, http://www.mycal.net #include "io_ports.h" #include int main () { int base, data_in, current_state = 0; long counter = 0; // // Lets use COM1 in this example. // base = COM1; // // Turn data slicer interface on. // open_io (); out_byte (base + MCR, 0x01); // Set DTR 1 DSR 0 to power up interface // // Loop forever, polling the CTS to read the input state of the // Data Slicer, Press ctrl-break to exit loop. // while (1) { // // read while input is the same just inc counter // while (current_state == (data_in = in_byte (base + MSR))) counter++; // // We have a change in state, Print out counter value // printf ("counter = %lx\n", counter); // // Re-initalize state for next counter value // current_state = data_in; counter = 0; } }