I need help with a python version for this C code:
#define HostBusy_high 0x02
#define control_register 0x37a
Out32 (control_register,(unsigned char)(Inp32(control_register) | HostBusy_high));
the Out32 and Inp32 are functions located in the inpout32.dll used to interface parallel ports. These functions take hex values as their parameters. I tried to code in python to get the desired value but that is not what I am getting. See python version below:
from ctypes import windll
#parallel port instance
p_port = windll.inpout32
HostBusy_high = 0x02
control_register = 0x37a
write_data = write(p_port(Inp32(control_register) | HostBusy_high))
Out32 (control_register,write_data))
With the code above i do not seem to get the value I want. I suspect it is the unsigned value.
Thanks
Maybe you just should get the modulo 256 of your value. Then it is surely unsigned. Examples: