AN2502 Freescale Semiconductor / Motorola, AN2502 Datasheet - Page 25

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
Normal Mode Code
Listing
;**********************************************************************
;* SCI NORMAL.asm
;**********************************************************************
;* A software interrupt driven SCI module using two TIM channels for
;* the HC08 MCU. Normal mode.
;*
;* By Jorge Zambada
;* Motorola SPS
;* Mexico Applications Laboratory
;* Guadalajara, Mexico
;* 2003
;**********************************************************************
;* NOTES:
;**********************************************************************
;* 1) In this code listing, one of the low cost family of the HC08,the*
;* JK3 MCU is used. This MCU has two TIM channels, one used for
;* transmission (CH1), and the other for reception (CH0).
;* 2) In the SCISend, a transmission is started for the byte stored in*
;* the transmission data register rSCTDR. In RXTX_Config are
;* configured the two channels for the two processes: reception and
;* transmission.
;* 3) Two different ISR, one for reception and one for transmission,
;* makes possible the full duplex operation of this software SCI
;* module.
;* 4) Bit times are calculated with a free running timer (TIM).
;* 5) A list of standard baud rates is shown below. Remember that the *
;* maximum baud rate is proportional to the input clock frequency of
;* the TIM.
;**********************************************************************
VectorStart EQU
; For TIM Prescaler of 1
; (Bus Freq)/(Baud Rate)=BITHI:BITLO ->1 bit time
; BITHI:BITLO x 1.3-26=BIT1HI:BIT1LO->1.3 bit time - pin check latency
; Example of 9600 bps, XTAL = 9.8304 MHz -> Bus Freq = 9.8304 MHz/4
; BITHI:BITLO = 2457600/9600 = $0100
; BIT1HI:BIT1LO = $0100*1.3 - 26 = $0133
;9600 baud
BITHI
BITLO
BIT1HI
BIT1LO
;4800 baud
;BITHI
;BITLO
;BIT1HI
;BIT1LO
;2400 baud
MOTOROLA
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
Using Two Channels of the HC08 TIM to Achieve a Full-Duplex Software SCI
$FFDE
$01
$00
$01
$33
$02
$00
$02
$80
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
AN2502/D
Software
25

Related parts for AN2502