- 博客(0)
- 资源 (3)
空空如也
mc9s08dz60 can 例程
相当详细讲解和分析,模块也相当稳定。void MSCANInit(void)
{
char sj,p;
char t_seg1, t_seg2;
if (!CANCTL0&0x01)
// Active MSCAN initialization mode
CANCTL0 =0x01;
// Wait until the MSCAN is in initialization mode
while (!CANCTL1&0x01)
;
sj = (SJW-1)<<6;
p = (BRP-1);
// Configures SJW and Tq clock Baud Rate Prescaler
CANBTR0 = (sj|p);
t_seg1 = (TSEG1-1);
t_seg2 = (TSEG2-1)<<4;
// Configure Time Segment 1 and 2, and one Sample per bit
CANBTR1 = (t_seg1 | t_seg2);
// Disables all the Filters
CANIDMR0 = 0xFF;
CANIDMR1 = 0xFF;
CANIDMR2 = 0xFF;
CANIDMR3 = 0xFF;
CANIDMR4 = 0xFF;
CANIDMR5 = 0xFF;
CANIDMR6 = 0xFF;
CANIDMR7 = 0xFF;
// Enable MSCAN and normal operation and select the oscillator clock as MSCAN clock source
CANCTL1 = 0x80;
2014-05-26
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人