AN2264 Motorola Semiconductor Products, AN2264 Datasheet - Page 5

no-image

AN2264

Manufacturer Part Number
AN2264
Description
Freescale Semiconductor, Inc.
Manufacturer
Motorola Semiconductor Products
Datasheet
Software
MOTOROLA
The temperature display module uses the Motorola/Metrowerks LIN drivers so
all I/O activity is handled outwith the application code which simply uses a
“LIN_GetMsg()” to receive the data provided by the sensor in the door mirror.
The use of the LIN drivers results in fairly simple application software for the
temperature node. In order to respond to a master request command frame (ID
0x3C), the user code has to include the function void LIN_Command(). This is,
for instance, how the master would request all slave nodes to go into their
low-power standby or “sleep” mode. In this application, sleep mode is entered
when there is no bus activity and this function is just a dummy while(1).
The main software flow diagram is shown in figure 2 and the complete code
listed in section 5. Once the variables have been declared, the CONFIG and
I/O registers are initialised. The CONFIG1 value of 0x71 disables the COP
while the CONFIG2 value of 0x19 configures the MCU as an
MC68HC908AZ60A (as opposed to an AS60A). Interrupts are enabled so that
the LIN drivers, once initialised by LIN_init(), can function. The main while loop
uses the programmable interrupt timer (PIT) to facilitate a 200Hz repetition rate
based on an 8MHz crystal. Once every 5ms the PIT overflow flag is set and the
main loop is executed to convert the binary input data into 7-segment format.
The 200Hz rate is also used to cycle round the 4 LED digits facilitating a flicker
free 50Hz multiplexed display. Although the LIN buffer is read and the
temperature converted into 4-digit 7-segment format every time, only one digit
is actually driven every 5ms.
The LIN driver function LIN_IdleClock can check whether or not there is any
bus activity. If not it increments a counter whose value is compared with
LIN_IDLETIMEOUT (defined in slave.cfg). If this number is exceeded the
function LIN_DriverStatus() ceases to return a 1 (LIN_STATUS_RUN)
indicating that the bus has been idle for, in this application, 2 seconds. If this is
detected, the enable pin of the MC33399 is taken low and the MCU is powered
down by the disabling of the LT1121. The code also sets the display to “….”.
This is irrelevant in the powered down application but gave an indication of a
detected idle condition in the development environment where the emulated
MCU’s power was not controlled by the LT1121. In this application it also made
sense to show a special display if temperature data was not being provided to
the module. Without this addition the display would continue to show the last
received temperature (or –30°C if none had been received since the last power
up). This feature was incorporated using LIN_MsgStatus(0x0A) in conjunction
with the variable error_count and forces the display to “----” after a second of
not receiving a LIN message with an ID of 0A (see figure 4).
To perform the conversion, the temperature byte is transferred to the variable
bits and, if the temperature is positive, the offset of 60 (30 C°) subtracted. This
would result in an incorrect underflowed value in bits if the temperature is
Freescale Semiconductor, Inc.
For More Information On This Product,
LIN Node Temperature Display
Go to: www.freescale.com
AN2264/D
Software
5

Related parts for AN2264