Created
January 14, 2015 19:48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <sys/io.h> | |
#include <sys/perm.h> | |
#define BASEPORT 0x378 | |
int main(void) | |
{ | |
int even = 0; | |
int inp, oldinp; | |
int i; | |
ioperm(BASEPORT+1,1,1); //rejestr statusu | |
for (i=0; i<10000000; i++) | |
{ | |
inp = inb(BASEPORT+1); | |
//inp = (uint8_t)inpr << 1; //bity 6:3 są mają być wykorzystywane | |
if (even == 0) | |
{ | |
oldinp = (inp & 0b01111000) >> 3; | |
even = 1; | |
} | |
else // składanie do kupy przy parzystych odczytach, nowy odczyt to 4 najbardziej znaczace bity, stary 4 najmniej | |
{ | |
inp = (inp & 0b01111000) << 1; | |
inp = inp | oldinp; | |
printf("%c",inp); | |
even = 0; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment