完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我想用50ms的定时器中断……如何配置这个…我没有逻辑,
我已经给1 MHz的时钟定时器模,,时期写的五万计数..所以是50ms计数周期。但我每次都被打断…我在TC模式下配置了中断… 所以我想我应该中断计数为零如果是计数器,,但是我不想.. 沙棘 16.7 K 以上来自于百度翻译 以下为原文 I want to use the timer interrupt of say 50ms... .. how to configure for this..i didnt ger the logic,,, i have give 1 Mhz clock to timer midule,, and write the 50000 count in period.. so it is 50ms count period.. but i am getting interrupt on every count... i have configured interrupt on tc mode... so i think i should get interrupt on zero count if it is down counter,, but i am not getting..
|
|
相关推荐
36个回答
|
|
我认为这是一个很好的实践总是重定向内置例程到一个写你自己。
以上来自于百度翻译 以下为原文 I think it is a good pratise to always redirect the build in routines to one that writen yourself. |
|
|
|
从这种风格中获得的最大利润是,当你从PSoC3切换到PSoC5时,你必须改变---根本没有。
否则,你必须再次插入所有的更改(不要忘记任何一点)。 只是重复我回答的主要原因:定时器中断(TC或比较)保留在状态寄存器中,因此在中断发生后可以检查。当未被清除时,中断程序在中断例程结束时重新启动。 计时器的数据表解释了状态寄存器中的一些位是“粘性”的,它们不反映实际状态,而是得到设置和保持设置,直到读取状态寄存器。因此,在中断例程中读取状态寄存器是一个必须做的事情! 快乐X-MAS,愿你的代码永不失败 鲍勃 以上来自于百度翻译 以下为原文 The most profit you get from that style is, when you switch from PSoC3 to PSoC5 you have to change --- nothing at all --- Otherwise you have to insert all your changes again (don't forget any bit). Just to repeat the main reason for my reply: the timer interrupt (Tc or compare) stays set in the status-register, so it can be examined after the interrupt occured. When it is not cleared, the interrupt is risen again when the interrupt-routine finishes wiht its RETI - instruction. The datasheet of timer explains that some of the bits in the status-register are "Sticky", they do not reflect the actual state, but get set and stay set until the status-register is read. So the read of the status-register in the interrupt-routine is a MUST-DO ! Merry x-mas and may your code never fail Bob |
|
|
|
你好,
我也有定时器中断的问题。当你使用UDB计时器时,所有的工作都很好。问题出现在FF(固定函数)定时器上,如“CY8C38 XXX Errase.pdf”所说: 44。使用提供给I/O引脚的外部时钟的固定功能定时器ISR问题定义可能导致ISR在一个中断条件下被多次执行。当使用芯片内部生成的时钟时,此问题不适用。 但是,即使使用内部CLK源(ILO 1KHz在我的情况下),问题仍然存在。我还没有达到使FF计时器正常工作的目的。我附加了CyPress定时器中断示例。默认情况下,选择UDB定时器。为了尝试我所说的,有必要改变FF计时器。我的设备是CY8C3666 AXI-040ES2。 当做。 AN540605.ZIP 3.9兆字节 以上来自于百度翻译 以下为原文 Hello, I've also had problems with Timer Interrupt. When you use the UDB Timer, all works fine. The problem appears with the FF(Fixed Function) Timer, as the "CY8C38xxx Errata.pdf" says: 44. Fixed Function Timer ISR ■ Problem Definition Using an external clock supplied to an I/O pin may result in an ISR becoming executed multiple times for a single interrupt condition. This issue does not apply when using a clock generated internal to the chip. But even when you use an internal CLK source (ILO 1Khz in my case) the problem persists. I haven't achieve make the FF Timer works properly. I attach the Cypress Timer Interrupt example. By default, a UDB timer is selected. In order to try what I'm saying, it is necessary change to FF Timer. My device is CY8C3866AXI-040ES2. Regards.
|
|
|
|
我有一个PSoC5处理器模块卡在我的开发工具包里,太糟糕了。我用LoTTVNC控制一切,但要花上几天时间才能改变我办公室的那个模块。然后我试一下PSoC3上的计时器。
圣诞快乐 鲍勃 以上来自于百度翻译 以下为原文 I have a PSoC5 processor-module stuck into my developement kit, too bad. I control everything with TightVNC, but it takes a few days until I can change that module in my office. Then I'll try the timer on a PSoC3. With the PSoC5 everything runs fine. Merry x-mas Bob |
|
|
|
最后,我得到了它的工作,尽管有很多废话:
首先,当你选择CLK源时,你不允许在ILO的“现有”资源中进行选择。然而,你可以在“新”蜱中选择ILO。 另外,在“新”的嘀嗒声中,如果选择源“AUTO”并配置1KHz FRQ(与ILO相同),则该设备工作出错,显示多个ISR跳转的问题。 但最可怕的是,有时即使选择ILO源,设备也会出错。我选择了“除法器”,而不是指定fruuthIn,1和同样。但我选择了“除法器”2和…工作正常!!!! 总之,所有的问题都来自于CLKs源。另一种使用FF定时器的解决方案用于中断控制器,定时器TC输出。 以上来自于百度翻译 以下为原文 Finally, I have got it work, despite there are many nonsense: - First of all, when you're selecting the CLK source, you are not allowed to choose in the "Existing" sources the ILO. However, you can choose the ILO in the "New" tick. - Plus, also in the "New" tick, if you select the Source "Auto" and configure a 1Khz freq (the same as ILO) the device works wrong showing the problem of the multiple ISR jump. - But the most terrifying is that sometimes, even when the ILO source is selected, the device works wrong. Instead of specify the frecuency, I chose the "Divider" by 1 and the same. But I chose the "Divider" by 2 and... works properly!!! In conclusion, all the problems come from the CLKs sources. Another solution using the FF Timer is use for the Interrupt Controler the Timer TC output. |
|
|
|
我用计时器和PSoC5 ES1做了一些尝试。
中断连接到TC,频率100 kHz,周期500,16位宽。 固定功能:中断不断出现 UDB:如预期的那样工作。 然后在TC输出和ISR输入之间放置一个D FF,固定功能块工作! 快乐编码 鲍勃 TimeRest.CyWrk.CaseV01.Zip 334.7 K 以上来自于百度翻译 以下为原文 I tried some more with a timer and PSoC5 ES1. An Interrupt was connected to TC, Frequency 100 KHz, Period 500, 16bit-wide Fixed function: Interrupt comes continously UDB: works as expected. Then I put a d-FF between TC output and ISR input and the fixed-function block works! Happy coding Bob
|
|
|
|
我的代码是这样的。
LCDA CHARY1LSTATE(); TimeRe11Sistar(); TimeRe1l写作时期(50000); IsRy11Enable(); ISRY11START(); LCD-CHARY1位置(0,0); LCDA CHARY1L打印字符串(“欢迎”); CyGloalActuabess;/*取消注释此行以启用全局中断。*/ (;) { 以上来自于百度翻译 以下为原文 my code is like this.. LCD_Char_1_Start(); Timer_1_Start(); Timer_1_WritePeriod(50000); isr_1_Enable(); isr_1_Start(); LCD_Char_1_Position(0,0); LCD_Char_1_PrintString(" WELCOME "); CYGlobalIntEnable; /* Uncomment this line to enable global interrupts. */ for(;;) { |
|
|
|
鲍勃,
非常感谢您的帮助和示例代码。 你说你从来没有在ISR.C文件中插入代码,但是我认为只要你在它们的注释定义的行之间插入代码,就可以了。你是说,当从PSoC3转换为PSoC5时,情况不是这样吗? 以上来自于百度翻译 以下为原文 Bob, Thanks a lot for the help and the example code. You said you never insert the code in ISR.C files, but I thought as long as you insert the code between their commented # define lines, it will be fine. And you are saying when convert from PSoC3 to PSoC5, it is not the case? |
|
|
|
当从IPSO3到PSOC5改变部件时,重新生成所有文件。所以文件中的所有插入物,尽管这些地方都被记录好了,必须重新制作。
我的经验与API ISRSARTEX(内部程序)和声明的例程是非常好的。特别是当你考虑到一些中断必须被清除的时候,遗忘的机会就在那里,墨菲定律会把你抓住! 鲍勃 以上来自于百度翻译 以下为原文 When changing the part ie. from PSoC3 to PSoC5 all the files are generated anew. so all the inserts in the files, though the places are documented well, have to be made anew. My experiences with the API ISR_StartEx(IntRoutine) and the declaration of the routine are very good. Especially if you consider, that some kinds of interrupts have to be cleared, the chance of forgetting somthing is there and then Murphy's law will get you! Bob |
|
|
|
|
|
|
|
几个月前,当我开始使用PSoC3时,我对这些生成的代码有太多的麻烦,因为每次我做了一些修改,创建者都会删除我的代码…直到有一天,我发现我要把我的代码放在两个定义的行之间。无论如何,我认为控制是一个好主意。这意味着我需要回去改变我所有的代码。
在我的项目中,我有几个中断,包括ADC、UART、SPI、定时器和I2C。当我搜索“RealStaseRealSt登记”时,似乎只有定时器有它,而不是任何其他中断。这是否意味着我不必手动清除其他中断的标志? 以上来自于百度翻译 以下为原文 When I started to use PSoC3 several months ago, I had so much trouble with these generated code because everytime I made some changes, Creator will erase my code... Until one day I found that I suppose to put my code between the # define lines. Any way, I think it is a good idea to take control. Well, this means I need to go back to change all my code. I have several interrupts in my projects, include ADC, UART, SPI, Timer, and I2C. When I search " ReadStatusRegister" it seems only Timer has it, not any other interrupts. Does this mean I don't have to manually clear the flag for other interrupts? |
|
|
|
我已经这样配置了。我有附属形象
组态JPG 40 K 以上来自于百度翻译 以下为原文 i have configured like this.. i have attache image
|
|
|
|
别管我的问题。
我做了一些挖掘,看起来它们都有一些清晰的读状态寄存器。 以上来自于百度翻译 以下为原文 never mind my question. I did some digging, and it seems they all have some sort of clear-on-read status registers. |
|
|
|
嗨,Dharmin,
如图所示,可以将中断设置在终端计数上。 接下来,在生成的ISR.C文件中,必须包含“TimeRy1.h”文件,并且将在ISR和MaN()之间使用的变量被声明为Extn。例如,一个名为“标志”的变量被声明为Extn。 这一部分必须写在α开始和α结尾部分之间。如果写在本节外,将被删除。下图显示相同。 现在,必须在ISR中实现的代码必须在yx开始和μ结尾部分之间的CysIsR()函数中写入。 必须小心读取定时器组件的状态寄存器,以便清除中断位(因为它是一个粘性位)。然后按照你的逻辑编写代码。下面提供了快照。 这应该让你的项目工作。 另一种方法是将中断组件直接连接到定时器组件上存在的TC终端。在这种情况下,不需要在定时器组件中启用中断,也不需要在ISR中读取状态寄存器。 以上来自于百度翻译 以下为原文 Hi Dharmin, You can set the interrupt on Terminal Count on as shown in the figure below. Next in the isr.c file generated, the "Timer_1.h" file has to be included and the variables which are to be used between the isr and the main( ) are declared as extern. Example, a variable named "flag" is declared as extern. This section has to be written between the #START and #END section. If written outside this section, it will be erased upon build. The snap below shows the same. Now, the code which has to be implemented in the ISR has to be written within CY_ISR( ) function between the #START and #END section. Care must be taken to read the Status Register of the Timer Component in order to clear the Interrupt bit (as it is a sticky bit). Then the code can be written as per your logic. The snap-shot is provided below. This should get your project working. Another way would be to connect the Interrupt component directly to the TC Terminal present on the Timer component. In this case, it is not required to enable Interrupt in the Timer component and also reading the Status Register in the ISR is not required. |
|
|
|
这超出了我对PSoC的了解。许多组件都有一个状态寄存器,它可以是红色的,如果它与清除一个生成的中断有关,这取决于实现。恐怕,我们必须强烈地研究数据表(叹息)。
但是有新的即将到来的组件,您甚至可以创建自己的组件,这些组件可以包含一个状态寄存器,其他硬件(ISR)可以连接到该状态寄存器。 你可以把它看作是一种编程风格,它对于干净和易读的代码非常重要(非常重要),它更易于维护,因此包含更少的bug,所以更便宜。 鲍勃 以上来自于百度翻译 以下为原文 This is beyond my knowledge of PSoCs. Many components have a state-register that can be red, if it has something to do with a bit to clear a generated interrupt depends on the implementation. I'm afraid, we have to study the datasheets intensely (sigh). But there are new upcoming components and you may even create your own ones, which in turn may contain a status register to which other hardware (ISR) can be connected. You can see it as a matter of programming style which is very (capital VERY) important for clean and easy readable code, which is easier to maintain and so contains less bugs and so - is cheaper. Bob |
|
|
|
您好,先生,我使用的是步进电机控制器,使用CyPress Appulink笔记,代码I有一个QO:如何决定PWM模块的时钟为给定的RPM,我不能得到完整的200 RPM的应用程序代码,
以上来自于百度翻译 以下为原文 hello sir, i am using stepper motor controller using the cypress appilcation note, and code i have one que: how to decide the clock of the PWM module for given RPM, i am not able to get full 200 rpm by your application code,,,, |
|
|
|
鲍勃,
在你的例子中,在TC和中断之间使用DFF与TC输出直接中断有什么好处? 谢谢, 以上来自于百度翻译 以下为原文 Bob, In your example, what's the benefit of using DFF between tc and interrupt comparing to tc output directly to interrupt? Thanks, |
|
|
|
步进电机旋转的速度是由许多因素决定的。其中之一是线圈被脉冲的速率。在PSoC3项目中,定时器产生周期中断,产生电机的每一步(或微步)。该定时器可用于以特定速度旋转电机,或用于特定位置(确切的步数)。为了设置电机的速度,定时器的中断周期由固件更新。
还要注意的是,每台电机都有其自身的速度限制,因为它的结构、尺寸、线圈中的宽度等。在电机的数据表中也会提到同样的情况。 以上来自于百度翻译 以下为原文 The speed at which a stepper motor rotates is determined by many factors. One of them is the rate at which the coils are pulsed. In the PSoC3 project a timer generates periodic interrupts that generate each step (or microstep) of the motor. This timer can be used to run the motor at a specific speed, or to a specific position (exact number of steps). To set the speed of the motor, the interrupt period of the timer is updated by firmware. Also note that every motor has its own limit on speed due its construction, size, number widning in coil and so on. The same will be mentioned in the datasheet of the motor. |
|
|
|
他,他,
没有DFF,它根本不起作用!看看以前的帖子。 或 如果您可以在硬件中检查(也应该使用PSoC3)删除FF,将块设置为固定函数(不按预期工作)将块设置为UDB -工作。这就是我的PSOC5 ES1硅的性能。 鲍勃 以上来自于百度翻译 以下为原文 He, he, without the DFF it doesn't work at all! have a look at the previous posts. or If you can check it in hardware (should work with a PSoC3 as well) remove the FF, set the Block to Fixed function (doesn't work as expected) set the block to UDB - works. that's the behaveour of my PSoC5 ES1 silicon. Bob |
|
|
|
只有小组成员才能发言,加入小组>>
751个成员聚集在这个小组
加入小组2063 浏览 1 评论
1823 浏览 1 评论
3631 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1759 浏览 6 评论
1507 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
501浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
353浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
408浏览 2评论
353浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
850浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-19 14:30 , Processed in 1.315504 second(s), Total 114, Slave 97 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号