完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,我是这个论坛的新手。我使用MPLAB X IDE V3.51,和声配置器和PIC32以太网启动器套件与PIC32 MX795F512L。我写了一个程序,实现Modbus协议,在设定的时间间隔对设备进行轮询。到目前为止,我已经使用了静态定时器驱动程序,但是由于Web服务器的目标应用程序,我改变了在一个time2上使用的计时器,并且我开始使用系统计时器服务。通过回调函数,我有不同的进程,它们以不同的周期开始。但是,当我启用使用USAT(使用回调函数)发送特定的Modbus帧时,问题就开始了。整个程序总是在同一个地方停止,在调试过程中,它在SysStM.C的程序代码896行“IF(ALARSCOUNT & LTT;PTMROJJ & GT;SysStCl计数)”中,生成一个代码为7的异常(“数据总线错误”)。有没有人知道我应该开始什么,因为我已经完成了我所有的想法来解决这个问题。谢谢。
以上来自于百度翻译 以下为原文 Hello. I'm new to this forum. I am using MPLAB X IDE v3.51, HARMony Configurator and PIC32 Ethernet Starter Kit with PIC32MX795F512L. I wrote a program that implements the MODBUS protocol to polling the device at the set time interval. I have used the static timers driver so far, but due to the target application that is the web server I changed the timers used on one timer2 and I started to use the system timer service. With the callback function, I have different processes that start with different periods. The problem, however, starts when I enable the sending of a specific MODBUS frame using USART (by using callback function). The entire program always stops in the same place, during debuggingit it is in the program code of sys_tmr.c on line 896 "if (alarmCount Thanks. |
|
相关推荐
8个回答
|
|
我相信你不能混合静态定时器和动态定时器。如果使用TCP/IP堆栈,则必须使用动态定时器。因此,将静态的更改为动态定时器。
以上来自于百度翻译 以下为原文 I believe you cannot mix static and dynamic timers. If you are using the TCP/IP stack, you must use the dynamic timers. So change the static one to a dynamic timer. |
|
|
|
动态计时器不像静态那样精确,在发送帧后,我必须使用它来计算MODBUS中的3.5个标志,但是正如你所说的,我会尝试使用回调作为一个拍摄(不是周期)。谢谢。
以上来自于百度翻译 以下为原文 Dynamic timer is not so accurate as static, I have to use it to count 3.5 signs in MODBUS after sending frame, but as you said I'll try to use callback as one shoot (not period). Thanks. |
|
|
|
你需要准确的计时器吗?我已经在静态和动态定时器上做了测试,并且可以在1毫秒的时间内使它们都非常精确。在设备配置Tab/DeVCFG1中使用PRIPLL、XT和CSECME。在驱动程序/定时器选项卡中,使用动态TMR实例0 /PysCale=8(不是256)。比尔
以上来自于百度翻译 以下为原文 How accurate do you need the timer to be? I have done tests on static and dynamic timers and can get both of them to be highly accurate at a 1 millisecond period. In the Device Configuration tab/DEVCFG1 use PRIPLL, XT, and CSECME . In the Drivers/Timer tab, use Dynamic, TMR Instance 0/Prescale=8 (not 256). Bill |
|
|
|
您需要创建一个动态计时器的第二个实例。并设置它以比和谐计时器更高的速率运行。确保其优先级较高。或者直接使用一个硬件计时器。和谐不是做任何事情你不能做得更好,因为你的具体应用你自己。BILP取决于BUAD率1毫厘可能不是好的MOD总线。您需要1.5位和3.5位。
以上来自于百度翻译 以下为原文 You need to create a second instance of a dynamic timer. and set it to run at a higher rate than the Harmony timer. Insure it Priority is higher. OR just use one of the hardware timers directly. Harmony is not doing anything you can't do better, for your specific application yourself. BillP depending on the Buad rate 1 millisec may not be good for mod bus. you need 1.5bits and 3.5 bit. |
|
|
|
我使用19200个BPS,所以3.5个符号持续1.82MS,假设2毫秒,我改变了你所说的:但是它仍然是例外。我已经试过了,但结果是一样的。我想知道有没有影响静态定时器驱动的动态USER驱动程序,也许在从静态到动态定时器之后,我也应该改变静态到动态USAT?
以上来自于百度翻译 以下为原文 I'm using 19200 bps, so 3.5 sign lasts ca. 1.82ms, I assume 2 ms. I changed as you said: but it still go to the exception. I tried already but the result was the same. I wonder if there is any influence dynamic timer driver with static usart driver, maybe after changing from static to dynamic timer I should also change static to dynamic usart? |
|
|
|
最后用直接定时器(PPLB)改变了帧准备发送过程中的代码。功能和问题已经消失了。也许我在程序中使用的指针有问题,我不知道为什么会这样。现在我要建立WebServer。谢谢你的回答。当做。
以上来自于百度翻译 以下为原文 Finally I changed code in procedure of preparing frame to send using timer directly (PLIB... functions) and the problem has gone. Maybe there was something wrong with pointers I used in the procedure - I'm not sure why this happened. Now I'm going to built in web_server. Thanks for answers. Regards. |
|
|
|
静态和动态驱动不应相互干扰。
以上来自于百度翻译 以下为原文 The static and dynamic drive should not be interfering with each other. |
|
|
|
@ UsMoualalGoad知道你现在可以开始了。如果你仍然对和谐驱动程序的静态和动态使用有一些疑问,我们可以讨论。
以上来自于百度翻译 以下为原文 @usermanual good to know that you are able to proceed now. if you still have some doubt on static vs dynamic usage of Harmony drivers, we can discuss. |
|
|
|
只有小组成员才能发言,加入小组>>
4814 浏览 9 评论
1823 浏览 8 评论
1743 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
2949 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2055 浏览 5 评论
452浏览 1评论
1107浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
355浏览 0评论
260浏览 0评论
LAN9252使用SQI通信,进行数字复位后读BYTE_TEST异常
1777浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-4-18 02:39 , Processed in 1.072156 second(s), Total 82, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号