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

📄 can_functions.c

📁 bf537 CAN接口测试程序
💻 C
字号:
#include "CAN_RX.h"

/*********************************************************************************
**																				**
** CAN_Setup_Interrupts -	Enables Mailbox Interrupts for Mailboxes Used		**
**																				**
*********************************************************************************/
void CAN_Setup_Interrupts()
{
	*pCAN_MBIM1 = MBIM7;	/* Enable Interrupt for Mailbox7					*/
	*pCAN_MBIM2 = MBIM24;	/* Enable Interrupt for Mailbox24					*/
	ssync();
} /* end CAN_Setup_Interrupts													*/


/*********************************************************************************
**																				**
** CAN_Enable -	Writes Mailbox Direction and Enable Registers before issuing a	**
**				CAN Configuration Request and waiting for a CAN Configuration	**
**				acknowledge before continuing.									**
**																				**
*********************************************************************************/
void CAN_Enable()
{
	/* Set Mailbox Direction													*/
	*pCAN_MD1 = CAN_RX_MB_LO;	/* No Low Mailboxes Are RX						*/
	*pCAN_MD2 = CAN_RX_MB_HI;	/* Mailbox 24 Enabled For RX					*/

	/* Enable Mailboxes															*/
	*pCAN_MC1 = CAN_RX_MB_LO; 	/* Enables Mailbox 7							*/
	*pCAN_MC2 = CAN_TX_MB_HI; 	/* Enables Mailbox 24							*/

	ssync();

	/* Exit CAN Configuration Mode (Clear CCR)									*/
	*pCAN_CONTROL &= ~CCR;

	/* Wait for CAN Configuration Acknowledge (CCA) to Clear					*/
	while(*pCAN_STATUS & CCA);

} /* end CAN_Enable																*/

⌨️ 快捷键说明

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