AN2633 Freescale Semiconductor / Motorola, AN2633 Datasheet - Page 14

no-image

AN2633

Manufacturer Part Number
AN2633
Description
LIN Drivers for SLIC Module on the MC68HC908QL4
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
AN2633/D
CodeWarrior Project — C Source Code Basic SLIC Driver
14
1
2
3
4
ENTER ISR AND LOAD
SLCSV INTO TEMPORARY
VARIABLE.
TRAVERSE THE SWITCH()
CASES UNTIL A MATCH
IS FOUND.
EXECUTION TIME OF THIS
WILL VARY DEPENDING
ON HOW MANY CASES
HAVE CODE, WHAT ORDER
CASES ARE LISTED IN,
AND THE EFFICIENCY AND
SETTINGS OF THE COMPILER.
WHEN FOUND, EXECUTE
THE CODE FOR THE
APPROPRIATE SERVICE
HANDLER.
WHEN FINISHED, JUMP TO
COMMON EXIT CODE WHICH
CLEARS THE INTERRUPT
FLAG. THIS SAVES ROM.
SPACE IF DESIRED, THIS
CODE CAN BE INCLUDED
AT THE END OF EACH
SERVICE HANDLER
In the C and ASM versions of this code, the same basic functions are
performed. The C ISR, in this case, is just a few bytes smaller than the ASM
ISR. This is primarily due to the efficiency of the CodeWarrior compiler and the
fact that there is not much code to handle many of the different cases. The
switch()statement in the C ISR is very sparsely populated and the compiler is
able to optimize very heavily. In more elaborate driver code, with support for
more messages and features, it is likely that the C version would become larger
than the ASM version.
SLCSV value of 0x2C (ID Received).
void SLIC_ISR(void)
LIN Drivers for SLIC Module on the MC68HC908QL4
Freescale Semiconductor, Inc.
For More Information On This Product,
Figure 9. SLIC-Based ISR Flowchart
...
temp_SLCV = SLCVS;
switch(temp_SLCSV)
{
case
break;
case
break
...
case
break;
case
...
if(SLCID=LINID)
break;
...
}
SLCS_SLCF = 1;
}
//___________________________end_SLIC_ISR_________
{
ID_found =
SLCD0
SLCD1
SLCDLC
}
Go to: www.freescale.com
0x00;
0x08;
0x28;
0x2c;
Figure 9
1;
//_______No interrupts pending_______
//___TX Buffer Empty - Checksum sent_
//_______Byte Framing Error_______
//_ID received correctly - parity OK_
= LINdata;
= 0;
= 0xC1;
//___end switch temp_SLCSV
shows the flow of the C based ISR with a
//
//
// Clear SLIC interrupt flag
Read SLCVS value
Switch is temporary measure
// Check ID
// Set ID found flag
// Load TX buffers
// Write DLC code to
// Start TX - STD Checksum
MOTOROLA

Related parts for AN2633