📄 main.c
字号:
/********************************************************************************************/
/* Project: Light module Demo */
/* LIN Driver integration */
/********************************************************************************************/
/* Copyright: (c) 2000 by Infineon Technologies */
/* Systems Engineering Automotive AI SM SEA */
/* Hermann Kern */
/********************************************************************************************/
/* Update: 10-Okt-00 */
/********************************************************************************************/
/* Revision: V1.00 */
/********************************************************************************************/
/* Remarks: initialization routines are genareted with DAvE V1.0 */
/**** include files *************************************************************************/
#include <reg164ci.h>
#include <intrins.h>
#include "Lin_driver.h"
#include "LIN_InitNode.h"
#include "User_lin_functions.h"
void GT1_vInit(void)
{
/// ------------ Timer 3 Control Register ----------
/// timer 3 works in timer mode
/// prescaler factor is 1024
/// up/down control bit is reset
/// external up/down control is disabled
T3CON = 0x0002;
T3 = 0x0000; // load timer 3 register
/// enable timer 3 interrupt
/// timer 3 interrupt priority level(ILVL) = 14
/// timer 3 interrupt group level (GLVL) = 0
T3IC = 0x0078;
/// use PEC channel 0 for GPT1 timer 3 interrupt
/// - normal interrupt
/// - word transfer
/// - pointers are not modified
PECC0 = 0x0000;
/// ---------- Timer 2 Control Register ----------
/// timer 2 works in reload mode
/// timer T2 is disabled
T2CON = 0x0020;
T2 = 0x0000; // load timer 2 register
/// ---------- Timer 4 Control Register ----------
/// timer 4 works in timer mode
/// prescaler factor is 8
/// timer 4 run bit is reset
/// up/down control bit is reset
/// external up/down control is disabled
T4CON = 0x0000;
T4 = 0x0000; // load timer 4 register
T3R = 1; // set timer 3 run bit
}
void main (void)
{
GT1_vInit();
// LIN initialization
LIN_vInitNode();
USER_vInitNode();
// load message buffer
USER_vSetData4(TMessage_1,0x33,0x25,0xE3,0x76);
USER_vSetData4(TMessage_2,0x54,0x65,0x02,0x80);
USER_vSetData4(TMessage_3,0x12,0x45,0xBC,0xDF);
LIN_vConnect();
// endless loop
while (1)
{
;
}
}
void GT1_viIsrTmr3(void) interrupt 0x23
{
// cyclic schedule call 100ms @20MHz
LIN_vSchedule();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -