AN2262 Motorola / Freescale Semiconductor, AN2262 Datasheet - Page 23

no-image

AN2262

Manufacturer Part Number
AN2262
Description
Wireless HC08 Modem
Manufacturer
Motorola / Freescale Semiconductor
Datasheet
MOTOROLA
PTAx/TCHx
The modulo register T2MOD (in the software for the RF-08 board, symbolic
name RFTimerMOD) is set so the TIM module in PWM mode generates the
data at the required speed. At 9600 baud, the time period is equal to 104 s.
The constants that are written to the modulo and output compare registers are
calculated at compile time by a series of macros:
The ‘Toggle on overflow’ feature is set, so the output level of the TXDATA pin
is toggled by TIM hardware at every timer overflow.
The output compare register T2CH0 (in the software for the RF-08 board,
symbolic name RFTimerCHTXD) is set to the half of this overflow period and
the ‘Set/reset on output compare’ feature prepares the value to be set/reset at
the next output compare event depending on which bit should be sent next.
This method effectively generates precise Manchester encoded data.
Figure 14
reaches the value stored in the output compare register, the level (value) set by
edge/level select bits in the status and control registers T2SC0_ELS0B and
T2SC0_ELS0A is transferred to the TXDATA pin. The status and control
registers T2SC0_ELS0B and T2SC0_ELS0A have the symbolic names
RFTimerTXD_ELSB and RFTimerTXD_ELSA in the RF-08 application. In
addition, the output compare interrupt is generated and the output compare
interrupt service routine (OC ISR) is called. Within this routine a value for the
next bit of transmission is stored to the edge/level select bits.
Figure 13. PWM Mode (Modulo-Up Counter)
In
In
wem.h
rf2.h
PULSE
WIDTH
#define BUS_CLOCK_HZ 3686400
#define RF_SPEED 9600L
#define RF_FULLBIT (BUS_CLOCK_HZ)/RF_SPEED
#define RF_HALFBIT (BUS_CLOCK_HZ)/(2*RF_SPEED)
PERIOD
shows how the Manchester encoding is handled. When the timer
COMPARE
OUTPUT
Wireless HC08 Modem
COMPARE
OUTPUT
COMPARE
OUTPUT
AN2262/D
Software
23

Related parts for AN2262