Specifications
October 25, 2006 Cypress Semiconductor – Rev. ** 55
LIN Bus 2.0 Reference Design 5. Demonstration Projects
// Enable Global Interrupts
M8C_EnableGInt;
// Infinite loop
// Inside the while Loop, following operations are performed.
// 1. l_ifc_read_status is called to check the status of the LIN core.
// 2. Frame1 data is updated with the Switch status
// 3. Frame2 status is checked to find if it has been updated. If yes,
// then the received data is processed to control the indicator lamps.
// 4. The bfGOTO_SLEEP in the LIN status register is checked. If set,
// the GoToSleep function is called
while(1)
{
// Read LIN Core Status
TransferStatus = (char)l_ifc_read_status();
// Update the switch states in Frame1
UpdateFrame1();
// Check if Frame2 is updated
if (BufferFrame2[0] & bfLAST_TRANSACTION_OK)
{
// Clear the Last Transaction OK flag
BufferFrame2[0] &= ~bfLAST_TRANSACTION_OK;
// Process the received data
ProcessFrame2();
}
/* Uncomment this to enable the Sleep operation
// Check if Goto Sleep flag is set
if (TransferStatus & bfSTATUS_GOTO_SLEEP)
{
GotoSleep();
}
*/
}// End of While loop
}