完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
大家好,我想收集有关如何设计/建立一个新的CAN项目的信息。我们将使用PICMX795F512L。一个重要的注意事项:我们需要能够在运行时改变波特率和其他参数。读取CAN驱动库的DOCs时,DRVICANIAL初始化:“这个例程在系统初始化时应该只调用一次。”所以我假设如果我使用C。一个驱动程序以后我不能改变波特率,并且使用了Orthor配置器中的参数。因为这对我们不起作用,所以我检查了CAN外围库。在这里我发现:我能理解方向必须被设定,但是“来自其他模块”意味着什么?我一直在看EngaySt寄样品,但我找不到这是在哪里设置的。问候,Jef
以上来自于百度翻译 以下为原文 Hi all, I'm trying to gather information on how to design /set up a new CAN project. We will be using PICMX795F512L. An important note: we will need to be able to change the baudrate and other parameters at runtime. Reading the docs of the CAN Driver Library the DRV_CAN_Initialize has: "This routine should only be called once during system initialization." So I assume if I use the CAN Driver I cannot change the baudrate later on and the parameters in the HARMony Configurator are used. Since that won't do the trick for us I checked the CAN Peripheral Library. There I find this: /* This code expects the data direction settings to be done from other modules */ /* Switch the CAN module ON */ PLIB_CAN_Enable(CAN_ID_1); I can understand direction must be set, but what does "from other modules" mean? I have been looking at the echo_send sample but I can't seem to find where this is set. Can someone shed some light here? Regards, Jef |
|
相关推荐
3个回答
|
|
|
它只是意味着在CAN代码中没有特定的地方来改变PIN,例如PORTSetPinsDigitalOut。关键是,你不应该改变CAN代码中的内容,而是要在程序的其他部分改变代码,以使代码保持干净。你可以将CAN模块放置在配置模式中,并随时改变速度。问题是:为什么要这样做?CAN网络通常包含多个节点,所有的速度都必须相同,所以不能只在所有节点上改变速度而改变速度。速度通常是你在设计阶段所决定的,因为它也有硬件含义。当然,软件是有耐心的,它会让你做任何事情,不管它是否有意义。
以上来自于百度翻译 以下为原文 It just means that there is no specific place in the CAN code for changing pin direcion with, say, PORTSetPinsDigitalOut. The point is, you should not be changing stuff in the CAN code, but in other parts of your program in order to keep the code clean. You can place the CAN module in configuration mode and change the speed at any time - the question is: why would you want to do this? CAN networks usually contain several nodes, and the speed has to be the same for all, so you can't just change the speed without changing it in all nodes. Speed is generally something you decide upon in the design stage, because it also has hardware implications. Of, course, software is patient and will let you do anything, whether it makes sense or not. |
|
|
|
|
|
感谢您的澄清。我们的设备将连接到几个不同的CAN网络在其生命周期。把它想象成一个PC接口,它需要根据它连接到哪个网络来配置。配置我的意思是改变波特率,过滤器,…在运行时,我对和谐是陌生的。我能不能用这个司机?你确切的意思是“你不应该改变代码中的东西,而是在程序的其他部分改变代码,以便保持代码干净”。你是说我不应该修改驱动程序代码吗?这似乎是显而易见的。我正在考虑使用CAN外围库函数制作我自己的“驱动程序”代码。这是一个可行的方法吗?
以上来自于百度翻译 以下为原文 Thanks for the clarification. Our device will be connected to several different CAN networks during its lifetime. Think of it as a PC interface that will need to be configured depending on which network it is attached to. With configure I mean changing baudrate, filters, ... at runtime. I'm new to Harmony. Am I correct I cannot use the driver for this? What do you exactly mean with "you should not be changing stuff in the CAN code, but in other parts of your program in order to keep the code clean". Do you mean I should not be modifying the driver code? That seems obvious. I'm thinking about making my own 'driver'-like piece of code using the CAN Peripheral Library functions. Would that be an ok way of doing this? |
|
|
|
|
|
您好,您在……CANIXIALIALIZE()中找到的文本是样板文本,它被抛入到所有的初始化函数中,假设在Orthor配置器中设置的任何东西都不需要更改。对于CAN驱动程序,只存在……静态驱动程序,它是一个转换成S的模板文件。OURCE代码通过配置器,硬编码源文件中的所有设置值。对于其他驱动程序,也可能在…/框架/驱动器/…目录中,在这些驱动程序中,…初始化(init)函数有一个结构参数,它可以有许多设置值被复制到硬件控制寄存器中。您可以运行具有不同选择和值的和声配置器,并比较生成的文件中的结果。A.Stimult.C',然后把它变成可以做你想做的事情。对于所有有一个……IyPrimalIZE()函数的驱动程序,也有一个“……去初始化(空)”函数,在你尝试调用初始化函数之前,应该调用它。或者你可以在你的文件中创建单独的代码。r,将CAN外围设备更改为CANION配置模式,更改设置,然后更改为正常模式,而不涉及初始化函数。如果您对Orthor配置器生成的文件进行更改,则可以给该文件一个不同的名称,和/或保留备份或源代码V。控制文件归档。如果您重新运行配置程序,“和声”可能会取消您的更改。迈西尔
以上来自于百度翻译 以下为原文 Hi, The text you have found in ...CAN_Initialize() is boilerplate text that is thrown into all _Intialize functions, assuming that whatever have been set up in Harmony Configurator never need to change. For CAN driver, there exist only ..._static driver, which is a template file which is turned into source code by the Configurator, hardcoding all setting values in the source file. For other drivers, there may also be '..._dynamic.c' driver available in the /framework/driver/... directory, in those drivers, the ...Initialize(init) function have a struct argument, which may have a number of setting values to be copied into hardware control registers. You may run the harmony configurator with different selections and values, and compare the outcome in the files produced, 'drv_can_static.c', then turn it into something that can do what you want. For all drivers where there is a ..._Initialize() function, there is also a '..._DeInitialize(void)' function that should be called before you try to call the initialize function again. Or you may make separate code in a file of your own, to change the CAN peripheral into CAN_configuration mode, change settings, and then change to Normal mode, without involving the initialize function. If you make changes to files generated by the harmony configurator, you may give the file a different name, and/or keep backup or source code version control archive. Harmony may undo your changes if you rerun the configurator program. Mysil |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
473 浏览 0 评论
5793 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1122浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1095浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
872浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
473浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-1 21:54 , Processed in 0.846366 second(s), Total 76, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
290