AN2575 Freescale Semiconductor / Motorola, AN2575 Datasheet - Page 11

no-image

AN2575

Manufacturer Part Number
AN2575
Description
MC68HC908EY16 ESCI LIN Drivers
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Freescale Semiconductor, Inc.
AN2575/D
Software
The LIN message is then read using function Read_LINtemp(). This is similar
to the code used in AN2264/D (see References) and the format of the
message is described in detail there. In this application, the message is only
being used to indicate whether the baud rate is accurate enough for the LIN
protocol to function correctly. Because of the low repetition rate through the
main loop, the buffer may be read less often than the arrival rate of the
message on the LIN bus. This is why a LIN_MsgStatus(0x0A) return of
LIN_MSG_OVERRUN is regarded as normal, along with LIN_OK.
The main loop then performs the calculation of the constant cnt1024. This is a
constant for a given value of ICGMR (5033 for an ICGMR of 64 in this
application) but is calculated each time around the loop in case ICGMR has
been changed using the adjust button. This is followed by the two functions
Format_line1() and Format_line2(), which convert the various numbers that
must be displayed into the ASCII format required for the LCD module. Adding
0x30 is all that is required for the decimal numbers. The array ASCIIconv[16] is
used to convert hexadecimal digits. The averaging calculations for the bottom
line display are performed within Format_line2().
The last function performed within the loop is actually writing the data for
display to the LCD module using the function Display_Data(data, mode). This
function in turn uses functions LCD_busy(), Write_Nibble(data), and
Clock_LCD(). Write_Nibble(data) is required because of the somewhat
inconvenient choice of port lines used to drive the LCD. (They were chosen to
be consistent with AN2498/D).
The interrupt service routine TimerA() uses channel 0 as an input capture to
read the number of timer counts between successive rising edges of the
external timing reference. The difference between the current value and the
previous value is calculated. Then that delta is put into the array of 16 values
that are used for the average frequency display.
MOTOROLA
MC68HC908EY16 ESCI LIN Drivers
11
For More Information On This Product,
Go to: www.freescale.com

Related parts for AN2575