5.6.2
Sample programs sequence
The LIN communication flowcharts for the sample programs are shown in "Figure 5-9 LIN
communication flowchart (main routine)" and "Figure 5-10 LIN communication flowchart (interrupt
routine: UART reception interrupts)".First, initialize the microcontroller, LIN-UART, and timer.
Next, implement LIN bus connection processing as a LIN slave. Thereafter, the program enters a
loop. Within the loop, monitor whether the data being sent and received can be completed in a fixed
cycle, and when the data has finished being received, implement processing according to the ID.
Synch break detection, ID reception, and data sending and receiving to operate as a LIN slave is
processed using LIN-UART reception interrupts. Further, the baud rate is adjusted within the input
capture interrupts as described in "Figure 5-11 LIN communication flowchart (interrupt routine:
input capture interrupts)".
Figure 5-9 LIN communication flowchart (main routine)
START
Initialize
microcontroller
Initialize LIN-
UART
Initialize timer
Process LIN bus
connection
Infinite loop
97
AN07-00200-03E