AN2575 Freescale Semiconductor / Motorola, AN2575 Datasheet - Page 10

no-image

AN2575

Manufacturer Part Number
AN2575
Description
MC68HC908EY16 ESCI LIN Drivers
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
AN2575/D
Software
10
In addition to the reset button, two buttons (trim and adjust) are also included,
as shown in
AN2498/D (see References). Pressing the trim button causes a trim
calculation and adjustment to take place. This function is debounced so that
only a single trim takes place even if the button is held down. The adjust button
can be used to manually change the value of ICGTR. It decrements this
register and does so repeatedly if it is held down. If, when the adjust button is
pressed, the trim button is also pressed, ICGTR is incremented. The software
incorporates an interlock so that the buttons can be released in either order
without causing an inadvertent trim operation that would corrupt the
deliberately modified value in ICGTR. If PTD1 is held low using the jumper
shown, ICGMR is displayed instead of ICGTR and the incrementing and
decrementing functions of the buttons are applied to ICGMR instead of ICGTR.
This arrangement allows any value of either register to be achieved and, if
desired, a trim operation performed from that configuration. However, for the
purposes of demonstrating the baud rate adjustment, only a single trim is
required and the value of ICGMR should not be changed from its initially
programmed value of 64.
The software for the ESCI baud rate adjustment demonstration application was
written and debugged using the LINkits evaluation PCB and the Metrowerks’
CodeWarrior
application incorporates the Motorola LIN drivers (1.3) whose baud rate
adjustment method is described in this application note.
The main software flow chart is
have been initialized, ICGMR is given the value 64. This gives the nominal bus
speed of 4.9152 MHz. The LIN drivers are configured (in file slave.cfg) for
9600 baud. The time base module is programmed with its maximum divide
ratio of 4,194,304 to give a slow (4 Hz) repetition rate through the loop. This
was done because the LCD is written to at this rate and there is no reason to
update it at a rate faster than the changing digits can be read. Timer A channel
0 is then set up to measure the time between successive rising edges of the
external reference signal coming from the MC74HC4040. The display module
and the LIN drivers are then initialized and interrupts enabled.
The main loop is timed by polling the time base module’s interrupt/overflow
flag. The buttons on bits 2 and 3 of port A are then read to determine whether
a trim operation or register adjustment is being requested. This is handled by
the function Read_buttons and incorporates a simple debounce and interlock
using the flag bounce. This flag prevents multiple trims from occurring if the trim
button is held down. It also prevents a trim if both buttons are pressed to
increment ICGTR or ICGMR and are then released in such a way that the trim
button is held down after the adjust button has been released.
Freescale Semiconductor, Inc.
For More Information On This Product,
MC68HC908EY16 ESCI LIN Drivers
Figure
Go to: www.freescale.com
development environment with a P&E Multilink interface. The
2. They perform the same functions as those described in
Figure
3. After the CONFIG and port registers
MOTOROLA

Related parts for AN2575