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

📄 linserviceroutinetemplate.c

📁 这是关于基于philips的764单片机的LIN程序设计
💻 C
字号:
#include "TJA1020.h"
#include "LinCmpSl.h"
#include "Relpc764.h"

char* data LinDataPtr;

//only for example
char aktTemp;

void LinServiceRoutine() 
{
//**do not delete**
 asm{0xC0, 0xD0}; //Push PSW
 asm{0xC0, 0xE0}; //Push ACC
 asm{0xC0, 0x00}; //Push AR0
//*****************
 
 if (LinError==0) //Test if LinError is '0'
   {
    if (LinFrameOk) 
      {
 //process here all IDs, the node should receive
 //e.g.
       if (LinID==0x14)
       	aktTemp=LinDataPtr[0];
      }
    else if (LinIDreceived)
      {
//process here all IDs, the node should send
//e.g.
       if (LinID==0x10)
       	{
       	  LinDataPtr[0]=0x08;
       	  TI=1;
       	 }
       else if (LinID==0x11)
         {
       	 LinDataPtr[0]=0x15;
       	 TI=1;
       	}
       else if (LinID==0x12)
         {
       	 LinDataPtr[0]=0x47;
       	 TI=1;
       	}
       else if (LinID==0x13)
         {
       	 LinDataPtr[0]=0x11;
       	 TI=1;
       	}		
      } 
   }
  else
   {
//process here the reaction on a Lin error
    LinError=0;
   }
   
//**do not delete**
 asm{0xD0, 0x00}; //Push AR0  
 asm{0xD0, 0xE0}; //Push ACC
 asm{0xD0, 0xD0}; //Push PSW  
//***************** 
 return;
} 



void main()
 {
  LinDataPtr=&LinData;
  InitTranceiver();
  InitLinMac();
  
  while(1){};
 }

⌨️ 快捷键说明

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