The 8051 Microcontroller and Embedded

(lily) #1
Department of Computer Scien

ce and Information Engineering

National Cheng Kung University
HANEL

SERIAL COMMUNICA-TION


PROGRAMMINGImportance of


RI Flag(cont’)


‰By checking the RI flag bit, we know whether or not the 8051 received a character byte


¾If we failed to copy SBUF into a safe place, we risk the loss of the received byte¾It must be noted that RI flag bit is raised by 8051 when it finish receive data¾It must be cleared by the programmer with instruction


CLR RI


¾If we copy SBUF into a safe place before the RI flag bit is raised, we risk copying garbage


‰The RI bit can be checked by


¾The instruction


JNB RI,xx


¾Using an interrupt

Free download pdf