#include "parport.h" #include #include #define PARPORT 0x378 int main(int argc, char *argv[]) { int value; init_parport(PARPORT); value=parport_read(); value/=8; //move LSB to bit 0 value^=0x09; //invert bits 0 and 3 (3 and 6 before move) according to manual //value^=0x0f; //invert bits 0, 1, 2 and 3 - needed on my computer printf("%x\n", value); //decadic output printf("%d%d%d%d%d\n", value&0x10?1:0, value&0x08?1:0, value&0x04?1:0, value&0x02?1:0, value&0x01?1:0); //binary output done_parport(); return 0; }