I use outb(1, 0x3BC) to turn on data pin 1 on my parallel port and outb(~1, 0x3BC) to turn off data pin 1. However, if I do outb(2, 0x3BC), data pin 2 turns on fine. But when I do outb(~2, 0x3BC) nothing happens. I can’t turn off any data pin except for pin 1. Why is that?
I tried this, but it turned off all the pins.
unsigned char current_value = inb(0x3BC); // Read current data port state
current_value &= ~2; // Clear bit 1 (turn off data pin 2)
outb(current_value, 0x3BC); // Write modified value back
New contributor
catandmoose is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2