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


I/O Ports and Bit Addressability


‰Sometimes we need to access only 1 or 2 bits of the portBACK:


CPL

P1.2

;complement P1.2

ACALL

DELAY
SJMP

BACK

;another variation

of the above program

AGAIN:

SETB

P1.2

;set only P1.2

ACALL

DELAY
CLR

P1.2

;clear only P1.2

ACALL

DELAY
SJMP

AGAIN

P0

P1

P2

P3
P1.0

P2.0P2.1P2.2P2.3P2.4P2.5P2.6P2.7
P1.1

P3.0P3.1P3.2P3.3P3.4P3.5P3.6
P1.2P1.3P1.4P1.5P1.6P1.7

P3.7

P0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.7

Port B

it D0D1D2D3D4D5D6D7
Free download pdf