AN2502 Freescale Semiconductor / Motorola, AN2502 Datasheet - Page 41

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
;**********************************************************************
;* This Subroutine configures the two channels:
;* -> Stop and Reset the timer.
;* -> Input capture on falling edges with interrupts enabled, so that *
;* we can detect the start bit.
;* -> Disable channel and set initial value of that pin
;* (IDLE STATE)
;* -> Set transmitter empty flag, to be prepared for first
;* transmission
;* -> Port configuration
;* -> Clear status flags
;* -> Enable interrupts
;* -> Run timer
;**********************************************************************
RXTX_config:
;**********************************************************************
;* GetByte subroutine is a friendly usage of the SCI Reception
;* features, which provides Flags check and storage of the received
;* byte in the H:X registers. The User would modify this subroutine
;* if the received data needs to be stored in another register or
;* memory location.
;**********************************************************************
GetByte:
MOTOROLA
LDA
STA
MOV
MOV
MOV
BSET
BSET
BCLR
CLR
CLI
BCLR
RTS
BRCLR
LDHX
BCLR
RTS
Using Two Channels of the HC08 TIM to Achieve a Full-Duplex Software SCI
#$30
TSC
#$48,TSC0
#$00,TSC1
#$10,rSCSR1 ; Set Tx Empty Flag
TPIN,PTD
TPIN,DDRD
RPIN,DDRD
rSCSR2
TSTOP,TSC
SCRF,rSCSR1,*
rSCRDRH
SCRF,rSCSR1
Freescale Semiconductor, Inc.
For More Information On This Product,
; stop and reset timer
; IC, Falling edge, with interrupts
; OC, output preset HIGH
; Set pin for Idle State
; Enable all interrupts
; Enable timer counter
; 1........ [3 CYCLES of instruction
;
; Wait for byte to be received. This
; flag is set when the received byte is
; moved from the reception shift
; register to the reception data
; register.
; Store received byte in the H:X
; registers
; Clear receiver full flag to allow
; more receptions
Go to: www.freescale.com
prior to interrupt]
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
AN2502/D
Software
41

Related parts for AN2502