No.76669 作者:dlm 邮件:dpzhang@xidian.edu.cn ID:33031 登陆:3次 文章数:1篇 最后登陆IP:219.245.82.21 最后登陆:2005/4/3 21:46:21 注册:2005/4/3 15:21:21 财富:55 发帖时间:2005/4/3 15:30:36 发贴者IP:219.245.82.21 标题:dlm:有没有做过can总线的朋友?遇到点问题想请教一下 摘要:No.76669有没有做过can总线的朋友?遇到点问题想请教一下 芯片初始化都没有问题了,我用自发自收模式,波特率是不是暂时就不用考虑了? 可是发送完以后,却收不到发出去的数据,怎么回事啊?sr和ir寄存器也没有错误提示。原因可能在哪里呢?匹配电阻用的是120欧姆的。 初始化程序: int init_can() { int data; wr_can((int*)MODE,9); data=rd_can((int*)MODE); while((data&0x1f)!=9) { wr_can((int*)MODE,9); for(data=0;data <100;data++); data=rd_can((int*)MODE); } wr_can((int*)CDR,0x0c0);//扩展模式,rxinten=1,RX1无效,时钟输出无效 wr_can((int*)IER,0x0c0); wr_can((int*)BTR0,0x40);//100k:44h,27h,500k:40h,26h wr_can((int*)BTR1,0x26); wr_can((int*)OCR, 0x1a); //tx0: 1Ah 通过TX1:c2h wr_can((int*)ACR1,0x0ff); wr_can((int*)AMR1,0x064); wr_can((int*)ACR0,0x0ff); wr_can((int*)AMR0,0x033); wr_can((int*)ACR2,0x0ff); wr_can((int*)AMR2,0x0ff); wr_can((int*)ACR3,0x0ff); wr_can((int*)AMR3,0x0ff); wr_can((int*)CMR,0x1e); wr_can((int*)RBSA,0); wr_can((int*)MODE,0x0c); if(rd_can((int*)MODE)==0x0c) {wr_can((int*)IER,0x0ff); return 1; //ok } ......
>>返回讨论的主题
|
老古网执行:47毫秒 最大:54049毫秒 查询6次
|
|