![Infineon 82C900 Скачать руководство пользователя страница 28](http://html1.mh-extra.com/html/infineon/82c900/82c900_application-note_2055171028.webp)
AP29002
Standalone TwinCAN Controller
Using special features of the 82C900
Application Note
27
V 1.0, 2004-02
The interrupt function reads only the received data from MSGOBJ0 and sends it back
via MSGOBJ2.
void INT_viIsrEx2(void) interrupt CC10INT
{
// USER CODE BEGIN (IR_IsrEx2,1)
unsigned char data[2]={0x00,0x00};
ReadData(0,data,2);
SendData(2,data,2);
// USER CODE END
}
The initialization functions for the CAN-Nodes:
// Node A 1 MBaut, IMC ist taken into account*/
void init_NodeA(void)
{
P_SendByte(ACR,0x41); // set bit CCE in ACR
P_SendByte(ABTR,0x02); // set DIV8X=0, TSEG2=3, TSEG1=4, SJW=1, BRP=2
P_SendByte(ABTR+1,0x23);// set DIV8X=0, TSEG2=3, TSEG1=4, SJW=1, BRP=2
P_SendByte(AIMR0,0x01);// take IMC0 into acount for INTID generation
P_SendByte(ACR,0x00);
// clear INIT, CCE in ACR
}
void init_NodeB(void)
{
P_SendByte(BCR,0x41); // set bit CCE in ACR
P_SendByte(BBTR,0x02);// set DIV8X=0, TSEG2=3, TSEG1=4, SJW=1, BRP=2
P_SendByte(BBTR+1,0x23);// set DIV8X=0, TSEG2=3, TSEG1=4, SJW=1, BRP=2
P_SendByte(BIMR0,0x01);// take IMC0 into acount for INTID generation
P_SendByte(BCR,0x00); // clear INIT, CCE in ACR
}