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

📄 klinecomm.h

📁 基于16位单片机的符合osek标准的操作系统
💻 H
字号:




/****************K Line Communication****************************/

extern void KLineSend(UINT8);
extern void KLineReceive(void);
extern void KLineTimer(void);
extern void KlineCommInit(UINT8 channel,UINT16 baudrate);
extern void KlineParaInit(void);
extern UINT8 CheckSum(void);  
extern void CreatRespMesKWP2000(void);                                       
extern void KlineCommunication(void);      
extern void ConfigCalibratedPara(void);                
        
/****************** K Line Communication data*******************/
EXTERN 	UINT16 un16RecordValue;
EXTERN 	float floRecordValue;

EXTERN UINT16 G_n16WakeUpDelay;//Wake Up K line Communication
EXTERN UINT8 G_bWakeUpFlag;//flag of Wake-Up K line Communication
EXTERN UINT16 G_n16CommDelay;//请求与ECU回应之间的延时 >25ms&<50ms
EXTERN UINT8 ucReadBuffer;
EXTERN UINT8 G_uc8Receivedata[300];//SCI 1 Receive Buffer 接收缓冲区
EXTERN UINT8 G_un16ReceivedataNum;//the number of received data from K Line 接收到的数据数目
EXTERN UINT8 G_ServiceID;//the Service ID of Requst Message Received
EXTERN UINT8 G_StartLocation;//Start Location of Message in the Receive Buffer
EXTERN UINT8 G_SIDLocation;
EXTERN UINT16 G_uc8RequstMLength;//the length of requst message
EXTERN UINT8 G_ReadDataPID;//Local Identifier of Reading Data By Local Identifier service
EXTERN UINT8 G_WriteDataPID;//Local Identifier of Writing Data By Local Identifier service
EXTERN UINT8 G_uc8MemoryAddressH;//memoryAddress (High Byte) of Reading Memory By Address service
EXTERN UINT8 G_uc8MemoryAddressM;//memoryAddress (Middle Byte) of Reading Memory By Address service
EXTERN UINT8 G_uc8MemoryAddressL;//memoryAddress (Low Byte) of Reading Memory By Address service
EXTERN UINT8 G_uc8MemorySize;//memorySize of Reading Memory By Address service

EXTERN UINT8 G_uc8ResponseMessage[260];//SCI 1 Transmmit Buffer 发送缓冲区
EXTERN UINT16 G_un16ResponseMLength;//the length of response message
EXTERN UINT8 G_bSendEnble;//报文写入发送缓冲区,准备发送
EXTERN UINT8 G_bSendComplete;//发送完成标志
EXTERN UINT8 G_bReceiveComplete;//接收完成标志
EXTERN UINT8 G_bSendReady;
EXTERN UINT8 G_n8ByteInter; 

EXTERN UINT16 G_un16SendNum;
 //K Line Communication Service ID Flag KWP2000-3
EXTERN BIT_Union8 _CommunicationFlag ;					
#define CommunicationFlag _CommunicationFlag.Byte
//#define bServiceID9 _CommunicationFlag.Bits.BIT0	//Flag of Service $09
#define bGeneralReject _CommunicationFlag.Bits.BIT1	//Negative Response code=0x10
#define bNotSurpport _CommunicationFlag.Bits.BIT2	//Negative Response code=0x11
#define bSubFunNotSup _CommunicationFlag.Bits.BIT3	//Negative Response code=0x12
#define bBusyRepeat _CommunicationFlag.Bits.BIT4	//Negative Response code=0x21
#define bCondNotCorrect _CommunicationFlag.Bits.BIT5//Negative Response code=0x22
#define bResponsePending _CommunicationFlag.Bits.BIT6//Negative Response code=0x78 
                            

EXTERN BIT_Union8 _CommunicationFlag0 ;					
#define CommunicationFlag0 _CommunicationFlag0.Byte
#define bStartFlag _CommunicationFlag0.Bits.BIT0		//Flag of StartCommunication 
#define bStopFlag _CommunicationFlag0.Bits.BIT1	        //Flag of 
#define bAccessTimingFlag  _CommunicationFlag0.Bits.BIT2//Flag of  
#define bStartSessionFlag _CommunicationFlag0.Bits.BIT3	//Flag of 
#define bHandshakeFlag _CommunicationFlag0.Bits.BIT4	//Flag of HandShakeCommunication 
#define bSecurityAccessFlag _CommunicationFlag0.Bits.BIT5//Flag of  
#define bECUResetFlag _CommunicationFlag0.Bits.BIT6		//Flag of  
#define bReadEcuIdFlag _CommunicationFlag0.Bits.BIT7	//Flag of 


EXTERN BIT_Union8 _CommunicationFlag1;					
#define CommunicationFlag1 _CommunicationFlag1.Byte
#define bReadDataLIDFlag _CommunicationFlag1.Bits.BIT0	    //Flag of ReadDatabyLocalID 
#define bReadDataCIDFlag  _CommunicationFlag1.Bits.BIT1   	//Flag of  
#define bReadMemoryByAFlag  _CommunicationFlag1.Bits.BIT2  	//Flag of  
#define bDefineLocalIdFlag _CommunicationFlag1.Bits.BIT3	//Flag of  
#define bWriteDataByLIdFlag _CommunicationFlag1.Bits.BIT4	//Flag of 
#define bWriteDataByCIdFlag _CommunicationFlag1.Bits.BIT5   //Flag of  
#define bWriteMemoryByAFlag _CommunicationFlag1.Bits.BIT6	//Flag of 


EXTERN BIT_Union8 _CommunicationFlag2 ;					
#define CommunicationFlag2 _CommunicationFlag2.Byte
#define bReadDTCBySFlag _CommunicationFlag2.Bits.BIT0	        //Flag of ReadDTCCommunication  
#define bReadStatusofDTCFlag  _CommunicationFlag2.Bits.BIT1   	//Flag of  
#define bReadFreezeDataFlag _CommunicationFlag2.Bits.BIT2	    //Flag of 
#define bClearFlag  _CommunicationFlag2.Bits.BIT3   	        //Flag of ClearDTCCommunication 
#define bIOControlByLIdFlag _CommunicationFlag2.Bits.BIT4	    //Flag of 
#define bIOControlByCIdFlag  _CommunicationFlag2.Bits.BIT5  	//Flag of 
#define bStartRoutineByLIdFlag _CommunicationFlag2.Bits.BIT6	//Flag of   
#define bStartRoutineByAFlag _CommunicationFlag2.Bits.BIT7	    //Flag of  

EXTERN BIT_Union8 _CommunicationFlag3 ;					
#define CommunicationFlag3 _CommunicationFlag3.Byte
#define bStopRoutineByLIdFlag _CommunicationFlag3.Bits.BIT0		//Flag of 
#define bStopRoutineByAFlag _CommunicationFlag3.Bits.BIT1	    //Flag of 
#define bRoutineResultByLIdFlag  _CommunicationFlag3.Bits.BIT2  //Flag of  
#define bRoutineResultByAFlag _CommunicationFlag3.Bits.BIT3	    //Flag of 
#define bDownloadFlag _CommunicationFlag3.Bits.BIT4	            //Flag of 
#define bUploadFlag  _CommunicationFlag3.Bits.BIT5  	        //Flag of 
#define bTransferDataFlag _CommunicationFlag3.Bits.BIT6	        //Flag of 
#define bTransferExitFlag _CommunicationFlag3.Bits.BIT7	        //Flag of


⌨️ 快捷键说明

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