?? sja1000.h
字號:
#ifndef SJA1000_H
#define SJA1000_H
#include "DEF.h"
//時鐘頻率16MHz
#define SJA_FOSC (16*1000*1000)ul
//SJA1000 Regsters Macro,in pelican mode
/*模式寄存器 bit0-bit4 復位、只聽、自檢測、驗收濾波器、睡眠*/
#define REG_MR 0
#define BIT_RM (1<<0)
#define BIT_LOM (1<<1)
#define BIT_STM (1<<2)
#define BIT_AFM (1<<3)
#define BIT_SM (1<<4)
/*命令寄存器 bit0-bit4 發送請求、中止發送、釋放接受緩沖器、清除數據溢出、自接受請求(信息可以同時發送和接收)*/
#define REG_CMR 1
#define BIT_TR (1<<0)
#define BIT_AT (1<<1)
#define BIT_RR (1<<2)
#define BIT_CDO (1<<3)
#define BIT_SSR (1<<4)
/*狀態寄存器 bit0-bit7 接受緩沖器、數據溢出、發送緩沖器、發送完成、接收、發送、錯誤、總線狀態*/
#define REG_SR 2
#define BIT_RBS (1<<0)
#define BIT_DOS (1<<1)
#define BIT_TBS (1<<2)
#define BIT_TCS (1<<3)
#define BIT_RS (1<<4)
#define BIT_TS (1<<5)
#define BIT_ES (1<<6)
#define BIT_BS (1<<7)
/*中斷寄存器 bit0-bit4 接收、發送、出錯、數據溢出、喚醒中斷, 用作中斷源識別*/
#define REG_IR 3
#define BIT_RI (1<<0)
#define BIT_TI (1<<1)
#define BIT_EI (1<<2)
#define BIT_DOI (1<<3)
#define BIT_WUI (1<<4)
/*中斷使能寄存器 bit0-bit4 接收、發送、出錯、數據溢出、喚醒中斷*/
#define REG_IER 4
#define BIT_RIE (1<<0)
#define BIT_TIE (1<<1)
#define BIT_EIE (1<<2)
#define BIT_DOIE (1<<3)
#define BIT_WUIE (1<<4)
//#define EN_IRQ (BIT_RIE|BIT_TIE|BIT_EIE|BIT_DOIE|BIT_WUIE)
#define DIS_IRQ 0x0
/*總線時序0,總線時序1,輸出控制,錯誤代碼捕捉*/
#define REG_BTR0 6
#define REG_BTR1 7
#define REG_OC 8
#define REG_ERR 12
/*驗收代碼acr0-3,驗收屏蔽amr0-3*,時鐘分頻*/
#define REG_ACR0 16
#define REG_AMR0 20
#define REG_CDR 31
void TsetSJA(void);
void SJA1000_TX(CanMessageStruct * msg);
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -