完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
是否有一套PIC18F45 K80的软件演示了如何在这个芯片上读写ICAN?我发现了一些其他图片的代码,但似乎并不兼容这一个。我所说的代码是由Microchip制造的“PIC18FXX8设备的CAN驱动”。K80有什么相似之处吗?
以上来自于百度翻译 以下为原文 Is there a set of software for the PIC18F45K80 that demonstrates how to read/write and init the ecan on this chip? I found some code for other PICs but doesn't seem to be compatible with this one. The code I'm speaking of is the "CAN drivers for PIC18Fxx8 devices" made by Microchip. Is there something similar for the K80 out there? |
|
相关推荐
3个回答
|
|
你看MCC了吗?现在也是示例生成器。
以上来自于百度翻译 以下为原文 Did you look at MCC? that is now the example generator too. |
|
|
|
实际上,我放弃了自己的代码,并使用MPLAB代码配置器的源代码来创建一切。我只添加:void main(void){uCAN_MSG帧;无符号字符d1;//初始化设备SYSTEM_Initialize();//如果在PIC18高/低优先级模式中使用中断,则需要启用全局高中断和低中断//如果在PIC中范围兼容模式中使用中断,则需要启用全局和外围中断//使用下列宏://启用高优先级全局中断//INTERRUPT_GlobalInter.HighEnable();//启用低优先级全局中断。//INTERRUPT_GlobalInter.LowEnable();//禁用高优先级全局中断//INTERRUPT_GlobalInter.High.ble();//禁用低优先级全局中断。//INTERRUPT_GlobalInter.Low.ble();//启用全局中断//INTERRUPT_GlobalInter.Enable();//启用外围中断//INTERRUPT_.pheralInter.Enable();//禁用全局中断//INTERRUPT_GlobalInter..ble();//禁用外围中断//INTERRUPT_.pheralInter..ble();d1=0;而(1){frame.frame.id=9;frame.frame.idType=0;//添加应用程序代码frame.frame.dlc=1;frame.frame.data0=d1++;CAN_.(&frame);}}}配置器提供了CAN_.。这里有一个线索——当我进入Chanz传输时,它的第一件事就是:(TXB0CONTITS TXReq!= 1){事实上,这个比特总是1。这告诉我芯片没有把数据包推到总线上,它继续在缓冲器中徘徊……布莱恩
以上来自于百度翻译 以下为原文 I actually gave up on my own code and used the MPLAB Code Configurator's source code to create everything. I merely added: void main(void) { uCAN_MSG frame; unsigned char d1; // Initialize the device SYSTEM_Initialize(); // If using interrupts in PIC18 High/Low Priority Mode you need to enable the Global High and Low Interrupts // If using interrupts in PIC Mid-Range Compatibility Mode you need to enable the Global and Peripheral Interrupts // Use the following macros to: // Enable high priority global interrupts //INTERRUPT_GlobalInterruptHighEnable(); // Enable low priority global interrupts. //INTERRUPT_GlobalInterruptLowEnable(); // Disable high priority global interrupts //INTERRUPT_GlobalInterruptHighDisable(); // Disable low priority global interrupts. //INTERRUPT_GlobalInterruptLowDisable(); // Enable the Global Interrupts //INTERRUPT_GlobalInterruptEnable(); // Enable the Peripheral Interrupts //INTERRUPT_PeripheralInterruptEnable(); // Disable the Global Interrupts //INTERRUPT_GlobalInterruptDisable(); // Disable the Peripheral Interrupts //INTERRUPT_PeripheralInterruptDisable(); d1 = 0; while (1) { frame.frame.id = 9; frame.frame.idType = 0; // Add your application code frame.frame.dlc = 1; frame.frame.data0 = d1++; CAN_transmit(&frame); } } The CAN_transmit was provided by the Configurator. Here's a clue-- when I step into the CAN_transmit, the first thing it is does is: if (TXB0CONbits.TXREQ != 1) { As it turns out, this bit is always 1. This tells me the the chip is not pushing the packet to the bus and it continues to linger in the buffer....? Bryan |
|
|
|
解决:必须将EnDRHI位设置为1。这样,问题就来了,再见。
以上来自于百度翻译 以下为原文 Solved: The ENDRHI bit MUST be set to 1. Did that, problems went bye bye. |
|
|
|
只有小组成员才能发言,加入小组>>
5159 浏览 9 评论
1998 浏览 8 评论
1927 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3170 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2223 浏览 5 评论
724浏览 1评论
608浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
497浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
621浏览 0评论
520浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-20 07:34 , Processed in 1.144745 second(s), Total 82, Slave 66 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号