|ARM Technical Support Knowledge Articles|
Applies to: C51 C Compiler
Information in this article applies to:
How do I read from one of the I/O ports on the 8051?
To read an I/O port on the 8051, you must ensure that the internal latch state is at a high level. To ensure that the port bit is high, write a 1 to it. Then you may simply read the port or port bit.
sbit P1_1 = 0x91; P1_1 = 1; // Set port for input var = P1_1; // Read P1_1 into var
Article last edited on: 2000-06-24 00:00:00
Did you find this article helpful? Yes No
How can we improve this article?