The 8051 Microcontroller and Embedded

(lily) #1
Department of Computer Scien

ce and Information Engineering

National Cheng Kung University, TAIWAN
HANEL
ROTATE INSTRUCTIONAND DATA
SERIALIZATIONSerializing Data

(cont’)


Write a program to bring in a byte of data serially one bit at a time via pin P2.7 and save it in register R2. The byte comes in with the LSB first.Solution:


MOV R5,#8
AGAIN: MOV C,P2.7 ;bring in bit

RRC ADJNZ R5,HEREMOV R2,A ;save itP2.7


CY


Register A
D7

D0

Pin

Free download pdf