完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
所以我实现通讯协议的终止与1.04us空白空间留言结束。
我的UART代码运行的很好,但我需要的是实现以下的情景 中的UART-Read字节 重置1.04US定时器 然后,当定时器溢出它必须意味着UART已经停止接收的消息是在每一个新角色,重置计时器。 所以我需要一个定时中断 EndoFoMeSeaGead=1; 我读了下面的线程是2岁和基于PSoC3所以想要得到更到什么定时器使用日期的建议。 HTTP://www. CyPress?COM/?APP =论坛和ID ID=2232和;RID=63168 以上来自于百度翻译 以下为原文 So I am implementing the comms protocol which terminates the end of message with a 1.04uS blank space. My UART code is working fine but what I need is to implement the following scenario UART-READ BYTE IN RESET 1.04US TIMER then when the timer overflows it must mean that the UART has stopped receiving and the message is over as every new character resets the timer. So I would need a timer interrupt which just said EndOfMessageFlag = 1; I read the following thread but it is 2 years old and based on the PSoC3 so wanted to get some more up to date advice on what timer use. http://www.cypress.com/?app=forum&id=2232&rID=63168 |
|
相关推荐
15个回答
|
|
嗨,伙计们,这花了一段时间,但现在开始工作了。
有几件事使它不起作用,首先是连续的定时器,我用一个ONHOT替换它,然后每次中断都重新启动它。 下一个问题是,我的定时完全错了,对于9600波特率,即每比特104US,而不是字节,我需要在每个字节之后重新启动定时器,将它改为833.33(8×104US)固定。 最后一个问题是中断优先级,计时器比UART需要更高优先级的中断。我得到了应用工程师的帮助,现在都在工作。 我真的很欣赏Dana和鲍伯,你的帮助是无价之宝,我现在将添加我的Modbus功能,并上传完成PSoC Modbus Slave到Github和这里。 以上来自于百度翻译 以下为原文 Hi Guys, well it took a while but it is working now. A few things were making it not work, first of all the continuous timer, I replaced this with a oneshot and then just kept restarting it every interrupt. The next thing is, I had the timing completely wrong, for a 9600 baud rate, that is 104uS per BIT, not BYTE, I was needing to restart the timer after every byte, changing this to 833.33uS (8*104uS) fixed that. The last thing was interrupt priority, the timer needed a higher priority interrupt than the UART. I got help from the applications engineers and it is all working now. I really appreciate Dana and Bob, your help is invaluable, I will now add my modbus functions and upload the finished PSoC Modbus Slave to Github and here. |
|
|
|
假设要将定时器字节重置为字节,如WDT行为,则简单
固定功能的定时器连续运行应该做的工作。时钟速率 定时器决定其分辨率,其宽度为总范围。将ISR设置为上升沿。 以上来自于百度翻译 以下为原文 Assuming you want to reset timer byte to byte, like WDT behaviour, then a simple fixed function timer running continuously should do the job. The clock rate of the timer determines its resolution, and its width total range. Set isr to rising edge. |
|
|
|
或者使用SyTalm计时器及其相关的中断。
HTTP://FixCal..ARM.COM/Help/Nojx.jSP?主题= /COM.ARM.DOC.DII0497 A/BHCCJGGA.HTML 使用系统参考指南和TRM的额外信息。 问候,Dana。 以上来自于百度翻译 以下为原文 Or use the systick timer and its associated interrupt. http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/Bhccjgga.html Use the system Refernece guide and the TRM for additional info. Regards, Dana. |
|
|
|
在寄存器TRM中有几个寄存器来控制同步器定时器。
MXY系统XXXX HTTP://www. CyPress?COM/?RID=78807 问候,Dana。 以上来自于百度翻译 以下为原文 In the register TRM there are several registers to control the systick timer - M0_SYST_xxxx http://www.cypress.com/?rID=78807 Regards, Dana. |
|
|
|
嗨,Dana
我尝试用固定函数计时器(我的首选方法),但我不知道如何继续重置价值回到零每当一个字节进来。 以上来自于百度翻译 以下为原文 Hi Dana I tried it with the fixed function timer (my preferred way) but I couldn't figure out how to keep resetting the value back to zero every time a byte comes in. |
|
|
|
只是意识到我使用的是TCPWM计时器而不是UDB计时器。我会尝试它与UDB一个现在看起来更容易
以上来自于百度翻译 以下为原文 Just realised I was using the TCPWM timer not the UDB timer. I will try it with the UDB one now it looks easier |
|
|
|
Dana,你最近对我很有帮助,如果你有时间,你可以看看工作区包,看看我哪里出错了。
我有一个连续运行的计时器,每个中断都按我想要的方式触发。我有一个UART中断,它存储接收到的字节并递增消息长度变量。 在计时器中断中,如果消息长度变量在5次中断中没有改变,它就意味着没有接收到字节,计时器停止。 这一切在我的头脑中都是有意义的,但似乎不是从计时器中断中获得下一个字节,而是在定时器中断中保持循环。可能有中断优先级的问题。无论如何,它只是不工作,我已经尝试清楚,在我的代码,所以它应该是可读的。 粘在定时器上 1.2兆字节 以上来自于百度翻译 以下为原文 Dana you have been so helpful to me lately if you get time can you have a look at the workspace bundle and see where I am going wrong I have a continuously running timer which works, the interrupt fires every 104uS as I want. I have a UART interrupt which stores the received byte and increments a message length variable. In the timer interrupt if the message length variable has not changed for 5 interrupts it must mean no bytes have been received and the timer stops. It all makes sense in my head but it seems that instead of coming out of the timer interrupt to get the next byte it just keeps looping in the timer interrupt. Maybe there is a problem with interrupt priorities. Anyway it is just not working, I have tried to be clear in my code so it should be readable.
|
|
|
|
首先我noicticed是ISR都设置为“源”。把它们设置成
上升沿。 我会仔细检查其余的项目。 问候,Dana。 以上来自于百度翻译 以下为原文 The first thing I noicticed is both ISRs are set to "Derived". Set them to rising edge. I will look over rest of project. Regards, Dana. |
|
|
|
谢谢,我试着把它们都从派生中更改,但是构建失败了,但是派生出来了。
以上来自于百度翻译 以下为原文 Thanks, I tried changing them both from derived but the build fails on anything but derived. |
|
|
|
我有一个想法:由于定时器时钟相对较慢,可能会发生计时器在终端计数停止,从而保持中断线高。我建议你在中断行中插入一行。
(87) MeaStimeSerixWruteCuter(0);/现在不在终端计数(TC) 鲍勃 以上来自于百度翻译 以下为原文 I've got an idea: since the timer clock is relative slow it might happen that the timer is stopped at terminal count thus keeping the interrupt line high. I would suggest that you insert a line in interrupts.c after the line containing MessageTimer_Stop(); // Near line 87 MessageTimer_WriteCounter(0); // Now not at terminal count (TC) Bob |
|
|
|
你好,鲍伯,谢谢你的帮助。
我试过了,但没用。第87行的循环是最后一个循环(5个空白空间循环),在我们到达这个循环时,应该已经接收到所有的字节和5个空白。 代码在这个循环之前失败,因为如果在其中设置断点,则只捕获第一个字符,其余的都是零。 如果我取出计时器,消息逻辑与断点一起工作,我得到一个完整的消息。然而,我需要在现实世界中的计时器。 看来,通过添加计时器中断,第一个字符进来,设置计时器前进,然后计时器只是停留在自己的小循环完全忽略剩余字符中断。 更令人困惑的一点是,虽然如果我设置断点在所有循环和单步执行程序似乎象预期的那样工作,然后当我按跑回到刚刚第一个循环。困惑的! 以上来自于百度翻译 以下为原文 Hi bob, Thanks for your assistance I tried that but it didnt help. The loop at line 87 is the last loop (the 5 blank space loop), by the time we get to this loop there should have been all the bytes received and 5 blank spaces. The code is failing before this loop because if I set a breakpoint in it, only the first character will be caught and the rest are zeroes. If I take out the timer, the message logic works with breakpoints and I get a full message out. However I need the timer in the real world. It seems that by adding the timer interrupt the first character comes in which sets the timer going, then the timer just stays in its own little loop totally ignoring the remaining character interrupts. The even more confusing bit though is that if I set breakpoints in all the loops and step through the program appears to work as expected, then when I press run it goes back to just getting the first one and looping. CONFUSED! |
|
|
|
你可以考虑就此提出一个案子。
提交一个技术案例 CyPress网站 “支持” “技术支持” “创建一个MyCase'” 问候,Dana 以上来自于百度翻译 以下为原文 You might consider filing a CASE on this - To file a tech case - www.cypress.com “Support” “Technical Support” “Create a MyCase” Regards, Dana |
|
|
|
你好达娜
我已经申请了一项技术,谢谢。我必须承认,我不确定科技案例是如何运作的。我能不能给他们带来任何问题?如果是这样的话,它看起来是个很棒的服务。 如果不是这样的话,我不想打扰他们。 以上来自于百度翻译 以下为原文 Hi dana i have filed a tech, thanks. I must admit I am not sure how the tech case thing works. Am I allowed to just bring any problem I have to them. Seems like a fantastic service if so. I don't want to bother them if this isn't the case |
|
|
|
我尝试用固定函数计时器(我的首选方法),但我不知道如何继续重置价值回到零每当一个字节进来。
通常对于UDB定时器,你必须停止它,在TCPWM的情况下,它也必须停止, 这是API调用(UDB,也有一个TCPWM),你会这样做。 以上来自于百度翻译 以下为原文 I tried it with the fixed function timer (my preferred way) but I couldn't figure out how to keep resetting the value back to zero every time a byte comes in. Normally for UDB timer you have to stop it, in the case of TCPWM it also has to be stopped, this is the API call (UDB, there is one for the TCPWM as well) you would do that - |
|
|
|
您的UART运行速度不够慢,不应该是一个问题
ISR停止定时器并更新它。但是,查看.LST文件以得到一个估计值。 时钟/指令将在ISR内部完成。记住呼叫 ISR内部的函数导致大量堆栈推送超出指令 做实际工作。因此,鲍伯的观点,仔细检查这一点。 另一种快速测试方法是以超慢波特率开始,并将其上升。 做一些测试。或者只是在ISR内部构造一个切换引脚测试 更新计时器所需的时间。PSOC和Creator的美,你能多快 建造一个测试项目… 问候,Dana。 以上来自于百度翻译 以下为原文 Your UART is running slow enough should not be a problem in ISR to stop timer and update it. However, look at .lst file to get an estimate of clocks/instructions it will take inside ISR to do this. Keep in mind calling functions inside ISR results in a lot of stack push above and beyond instructions to do the actual job. So to Bob's point, carefully examine this. Another quick way of testing is start with a super slow baud rate and ramp it up doing some testing. Or just construct a toggle pin test inside ISR to measure the time its taking to update timer. Beauty of PSOC and Creator, how fast you can construct a test project..... Regards, Dana. |
|
|
|
只有小组成员才能发言,加入小组>>
713个成员聚集在这个小组
加入小组1888 浏览 1 评论
1639 浏览 1 评论
3393 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1556 浏览 6 评论
1371 浏览 1 评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
170浏览 2评论
170浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
304浏览 2评论
325浏览 1评论
45浏览 1评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-3-29 17:44 , Processed in 0.826072 second(s), Total 87, Slave 71 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 深圳华秋电子有限公司
电子发烧友 (电路图) 粤公网安备 44030402000349 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号