The 8051 Microcontroller and Embedded

(lily) #1
Department of Computer Scien

ce and Information Engineering

National Cheng Kung University, TAIWAN
HANEL

I/O BIT


MANIPULATION PROGRAMMING Reading Input Pins vs. Port


Latch


‰In reading a port


¾Some instructions read the status of port pins¾Others read the status of an internal port latch


‰Therefore, when reading ports there are two possibilities:


¾Read the status of the input pin¾Read the internal latch of the output port


‰Confusion between them is a major source of erro


rs in 8051 programming


¾Especially where external hardware is concerned

Free download pdf