English
Language : 

SH7047F Datasheet, PDF (61/85 Pages) Renesas Technology Corp – Renesas 32-Bit RISC Microcomputer SuperH RISC engine Family/SH7047 Series
PB.PBCR1 = 0x0000;
/* Set PB HCAN-2 */
PB.PBCR2 = 0x000F;
/* Set PB HCAN-2 */
/* Set bit rate (BCR): bit rate is 250 kbps when φ = 50 MHz */
HCAN_BCR0 = 0x0009;
/* BRP=9(10 system clock) */
HCAN_BCR1 = 0x4300;
/* TSEG1=4(5tq),TSEG2=3(4tq) */
/* Initialize mailbox */
work = (unsigned short *)0xFFFFB100;
do {
*work = 0xFFFF;
work++;
} while(work < (unsigned short *)0xFFFFB4F4);
/* Set MBC */
HCAN_MB0.MC4 = 0x03;
/* Set mailbox 0 as for reception */
/* Set interrupts */
HCAN_IMR = 0xFFFD;
/* Enable message reception
interrupts */
HCAN_MBIMR0 = 0xFFFE; /* Enable mailbox 0 reception interrupt requests */
INTC.IPRK = 0x00F0;
/* Set RM1 priority */
/* Set reception method */
HCAN_MB0.MC0 = 0x0000;
/* Select data frame and standard format,
set identifier */
HCAN_MB0.MC5 = 0x08;
/* Set data length: 8 bytes */
set_imask(0);
while(1);
}
/********************************************************************************/
/*
Reception interrupt routine
*/
/********************************************************************************/
#pragma interrupt(RM1_IRR1)
void RM1_IRR1(void){
/* Clear reception end register */
HCAN_RXPR0 = 0x0001;
/* Clear reception end flag (to clear, write 1) */
/* Prohibit reception interrupts */
HCAN_IMR = 0xFFFF;
/* Prohibit message reception interrupts */
}
Rev. 1.00, 08/03, page 53 of 74