微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > CAN总线通信程序

CAN总线通信程序

时间:12-13 来源:互联网 点击:

#define TXFrameInfo1 XBYTE[CS1_SJA1000+16]
#define TXID1 XBYTE[CS1_SJA1000+17]
#define TXID2 XBYTE[CS1_SJA1000+18]
#define TXID3 XBYTE[CS1_SJA1000+19]
#define TXID4 XBYTE[CS1_SJA1000+20]
#define TXDATA1 XBYTE[CS1_SJA1000+21]
#define TXDATA2 XBYTE[CS1_SJA1000+22]
#define TXDATA3 XBYTE[CS1_SJA1000+23]
#define TXDATA4 XBYTE[CS1_SJA1000+24]
#define TXDATA5 XBYTE[CS1_SJA1000+25]
#define TXDATA6 XBYTE[CS1_SJA1000+26]
#define TXDATA7 XBYTE[CS1_SJA1000+27]
#define TXDATA8 XBYTE[CS1_SJA1000+28]

#define RXFrameInfo1 XBYTE[CS1_SJA1000+16]
#define RXID1 XBYTE[CS1_SJA1000+17]
#define RXID2 XBYTE[CS1_SJA1000+18]
#define RXID3 XBYTE[CS1_SJA1000+19]
#define RXID4 XBYTE[CS1_SJA1000+20]
#define RXDATA1 XBYTE[CS1_SJA1000+21]
#define RXDATA2 XBYTE[CS1_SJA1000+22]
#define RXDATA3 XBYTE[CS1_SJA1000+23]
#define RXDATA4 XBYTE[CS1_SJA1000+24]
#define RXDATA5 XBYTE[CS1_SJA1000+25]
#define RXDATA6 XBYTE[CS1_SJA1000+26]
#define RXDATA7 XBYTE[CS1_SJA1000+27]
#define RXDATA8 XBYTE[CS1_SJA1000+28]

#defineGoToRESET0x01
#defineReleaseRXBuf0x04
#defineRequest_TX0x01

#defineNOT0
#defineYES1
//4800bps 5bits 1.04mS
#define TIME_MS1
#define temp_TH0(0 - 922*TIME_MS)/256
#define temp_TL0(0 - 922*TIME_MS)%256

sbit LED1 = P1^2;
sbit LED2 = P1^3;
sbit LED3 = P1^5;
sbit LED4 = P1^4;
sbit WDT = P3^4;

void System_init(void);
void Delay(unsigned char time);
void W_WDT(void);
void Interrupt_init(void);
void CAN_init(void);
//void CAN_Transmit(unsigned char Farmeinfo);
void CAN_Transmit(bit FarmeType);
void CAN_Receive(void);
void Timer_init(void);
void UART_ini(void);
void UART_Send_Byte(unsigned char Data);
void UART_Transmit(void);
void Clear_Buffer(unsigned char *pointer,unsigned char length);

#endif

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top