beautypg.com

An118 – Cirrus Logic AN118 User Manual

Page 29

background image

AN118

AN118REV2

29

;****************************************************************
;* Routine - RXSER
;* Input - none
;* Output - Byte received is placed in R7
;* Description - This subroutine receives 1 byte from converter
;* via UART. It uses the RS-232 serial protocol to transmit
;* one byte from a PC/UART system to the 8051.
;****************************************************************

; The function prototype is: char RXSER(void);

$DEBUG
USING 0

; Use register bank 0

TCOD SEGMENT CODE

; Define ROUT as a segment of code

PUBLIC RXSER

; Make subroutine global

RSEG TCOD

; Make code relocatable

RXSER:

JNB

SCON.0,$ ; Poll RI

MOV

R7,SBUF ; Place received byte in R7

CLR

SCON.0

; Reset RI bit

RET

END