hello, I am new to programming ... that is why I am not sure if the problem I am having is easy to solve or I am nowhere near
ok, I am trying to control a few things from my computer by the means of LPT (parallel port).
the OS is winXP pro, port address is 0x378.
Two parts to this are obviously the software and the hardware;
now I put together 8 lids which go bright accordingly to the 'cell' at the address 0x378
example: content of 0x378 is 0001 1010, the lids #4,5,7 will go up.
to write and read from the port, I am using
hLib = LoadLibrary("inpout32.dll");
inp32 = (inpfuncPtr) GetProcAddress(hLib, "Inp32");
oup32 = (oupfuncPtr) GetProcAddress(hLib, "Out32");
i = 0x378; // address
x = (inp32)(i); // x is char recieves value in hex from inp32
print_values(x, i); // this function converts from hex to binary so i can see A as 1010
the problem is that I dont seen to understand the logic of 0x378, here are the results i get with small numbers 0-15 (print out statements match the lids):
input(software) output(software, hardware)
0000 (0) 0000
0001 (1) 0001
0010 (2) 0000
0011 (3) 0001
0100 (4) 0000
0101 (5) 0011
0110 (6) 0000
0111 (7) 0011
1000 (8) 0000
1001 (9) 0101
1010 (A) 0010
1011 (B) 0111
1100 (C) 0000
1101 (D) 0101
1110 (E) 0010
1111 (F) 0111
it seems that in most of cases when the input(converted in binary) ends on '0', the output will be all 0's, if the number ends on '1', then the output seems to be the rest of the number *look at input 3,7,F ... but half the other input values are not as predictable.
I am constantly monitoring 0x379, but I can not read first bit of 0x379 (protected by OS), the rest are not changing.
any ideas? aside of hardwiring the output accordingly to the every possible input 0-FF
if you've read up to here, I thank you anyways for spending that much of your time on this post and I am eternaly gratefull to the people who'd reply with something constructive