AN2502 Freescale Semiconductor / Motorola, AN2502 Datasheet - Page 28

no-image

AN2502

Manufacturer Part Number
AN2502
Description
Using Two Channels of the HC08 TIM to Achieve a Full-Duplex Software SCI
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
AN2502/D
;**********************************************************************
;* PutByte subroutine is a friendly usage of the SCI Transmission
;* features, which provides Flags check and storage from the
;* accumulator to the transmission register. User would modify this
;* subroutine if the byte to be sent is stored in another register or *
;* location.
;**********************************************************************
PutByte:
;**********************************************************************
;* SCIsend.
;* PutByte calls this subroutine.
;* if no transmission is in progress, this subroutine configures the
;* transmit channel and calculates the time to send the start bit.
;* The value stored in TCH1H:TCH1L represent a time dependent to the
;* baud rate referenced as BITHI:BITLO. If a transmission is in
;* progress, the byte to be transmitted is queued for transmission.
;**********************************************************************
SCIsend:
28
BCLR
RTS
STA
JSR
BRCLR
RTS
BCLR
BRSET
BCLR
LDHX
TXA
ADD
TAX
PSHH
PULA
ADC
PSHA
PULH
STHX
BSET
Using Two Channels of the HC08 TIM to Achieve a Full-Duplex Software SCI
SCRF,rSCSR
rSCTDR
SCIsend
SCTE,rSCSR,*
SCTE,rSCSR
CH1IE,TSC1,SCIsend_end
CH1F,TSC1 ; Program goes here if there is no
TCNTH
#BITLO
#BITHI
TCH1H
SCTE,rSCSR
Freescale Semiconductor, Inc.
For More Information On This Product,
; Clear receiver full flag to allow
; more receptions
; Store the accumulator content in the
; transmission shift register
; Start byte transmission
; Wait for the byte to be transferred
; to the transmission shift register
; Clear transmitter empty flag
; If transmission channel
; is active, the byte to be transmitter
; is queued and exits SCISend subroutine
; transmission in progress
; Read current count
; Add 1 bit time for
; next compare to send start bit.
; Store calculated value in transmission
; channel.
; Set transmitter empty flag,
Go to: www.freescale.com
*
*
*
*
*
*
*
*
*
*
*
MOTOROLA

Related parts for AN2502