beautypg.com

An118 – Cirrus Logic AN118 User Manual

Page 30

background image

AN118

30

AN118REV2

;****************************************************************
;* Routine - TXSER
;* Input - Byte to be transmitted is placed in R7
;* Output - None
;* Description - This subroutine transfers 1 byte from converter
;* via UART. It uses the RS-232 serial protocol to transmit
;* one byte from a 80C51 to the PC/UART system. To
;* function properly, the programmer must first initialize the
;* TI bit in the SCON register to 0X01.
;****************************************************************

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

$DEBUG
USING 0

; Use register bank 0

TCOD SEGMENT CODE

; Define TCOD as a segment of code

PUBLIC _TXSER

; Make subroutine global

RSEG TCOD

; Make code relocatable

_TXSER: JNB

SCON.1,$ ; Poll TI

CLR

SCON.1 ; Reset TI

MOV

SBUF, R7 ; Move byte to output register

RET

; Exit subroutine

END