⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lin_cfg.h

📁 周立功dp51h附带lin总线通讯代码,包括master和slave
💻 H
字号:
#ifdef 	LIN_CFG_GLOBALS
#define LIN_CFG_EXT
#else
#define LIN_CFG_EXT 	extern 
#endif 


#define l_bool   		bit
#define	l_ioctl_op		sbit
#define l_irqmask		sbit
#define l_u8			unsigned char
#define l_u16 			unsigned int

#define OSC_FREQ 			11059200     	//Oscillatorfreq in Hz
#define LINBAUDRATE 		9600    		//Baudrate in bit/s
#define COREMODE			6				//CPU in 6 or 12 clock-mode  

#define id_932led			(0X42)

#include "ZLG7290.h"
#include "VIIC_C51.h"
#include "lin_hal.h"
#include "lin_def.h"
#include <string.h>

#ifdef LIN_CFG_GLOBALS
/*
ID_Table
========
*/
#define ID_TABLE_SIZE       4      			/* number of identifiers relevant  */
                                           	/* for the application:            */
                                           	/* sizeof(ID_Table). See lin_drv.c */
code t_id_list ID_Table[ID_TABLE_SIZE]=
		{
		{0x02, ID_DATAREQUEST, 2},                 /* application example */
		{0x12, ID_DATAREQUEST, 2},                 /* application example */
		{0x22, ID_DATASENT, 4},                    /* application example */
		{0x80, ID_DATASENT, 2}     /* LIN v1.1 */  /* application example */
//		{0x3C, ID_DATASENT, 8}     /* LIN v1.2 */  /* application example */
		};
/******************************************/
//0x02: connect to slave1
/*	0:disconnect; 1: connect;
/*
//0x12: read the status form slave1
/*	status : XXXX**XX B
/*BIT0 to BIT1 :the direct of the led 
/*	0:error; 1:nolight; 2:left; 3:right;
/*BIT4 to BIT7 :the speed of the led
/*	rage: 0-15; more few and more fast
/*
//0x22: send the command to slave1
/*	command : XXXX**XX B
/*BIT0 to BIT1 :the direct of the led 
/*	0:error; 1:nolight; 2:left; 3:right;
/*BIT4 to BIT7 :the speed of the led
/*	rage: 0-15; more few and more fast
/*
//0x80:	send the sleep signal to bus
/******************************************/
#endif

#define 	SCH_NUM		5

#ifdef LIN_API_GLOBALS
code l_u8 left_0_cmd_frame[]={0x02,0,0,0};
code l_u8 right_2_cmd_frame[]={0x23,0,0,0};
code l_u8 sleep_frame[]={0,0};

code t_schedule MySchedule1[SCH_NUM]=
		{
		{0,0,NULL,150},
		{1,2,left_0_cmd_frame,150},	
		{2,1,NULL,500},
		{3,2,right_2_cmd_frame,150},
		{4,1,NULL,500}
		};
#endif

extern code t_schedule MySchedule1[SCH_NUM];

sfr ckcon=0x8f;
sbit SLNP=P1^3;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -