AN2502 Freescale Semiconductor / Motorola, AN2502 Datasheet - Page 29

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
SCIsend_end:
;**********************************************************************
;* This ISR is dedicated only for transmission. each transmitted bit
;* including start bit and stop bit generate this interrupt.
;* Each transmission bit configures the polarity of output compare:
;* for example, if the next transmission bit is a logic '1', the
;* channel is configured as set on output compare after a 1 bit time. *
;* If there is a transmission in progress, this routine stores a $80
;* in the transmit shift register for 8 transmission bits plus a Stop *
;* Bit. If there is no byte queued to be transmitted, the
;* transmission channels are disabled for Idle State. If there is a
;* byte to be transmitted in the queue, the time for next start bit
;* is calculated and the new transmission is started.
;**********************************************************************
TX_isr:
oc_highorlow:
MOTOROLA
MOV
MOV
RTS
PSHH
BCLR
BRSET
BSET
LDHX
TXA
ADD
TAX
PSHH
PULA
ADC
PSHA
PULH
STHX
SEC
ROR
BCS
Using Two Channels of the HC08 TIM to Achieve a Full-Duplex Software SCI
rSCTDR,rSCTSR
#$58,TSC1 ; Config. channel 1 as OC with
CH1F,TSC1
TPF,rSCSR,txinprog
TPF,rSCSR ; Program goes here if no transmission
TCH1H
#BITLO
#BITHI
TCH1H
rSCTSR
oc_high
Freescale Semiconductor, Inc.
For More Information On This Product,
; indicating that a new data to be
; transmitted can be queued.
; Move data from Tx Register to
; Tx Shift Register
; interrupts enabled.
; Clear on output compare for start bit
; Check if there's a
; transmission in progress
; is in progress
; Calculate the time for next bit to
; be transmitted. Start bit was already
; sent by the SCISend subroutine
; Set time for next OC
; after 1 bit time
; Store the calculated time in the
; channel register for next output
; compare
; With this operation, the bit to be
; transmitted is copied in the carry
; flag
; if Carry is High, the transmission
; channel is configured to set on
Go to: www.freescale.com
*
*
*
*
*
*
*
*
*
AN2502/D
Software
29

Related parts for AN2502