完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,
我正在调试睡眠ISR代码,我知道它是否运行得很好!我在用冰块…我想这样做,PSoC 1在X时间(例如20秒)睡觉,并在这个时间醒来后,做一个中断Rutin(1赫兹,CouSun)从ADC获得数据,并将其保存在EEPROM中。中断之后,再睡一次…正如我可以看到的调试器是当程序启动到MC8睡觉时,当我按下F5,进入中断,当它已经完成,返回到睡眠MC8。在这一刻,冰块看起来断开,但电路板CY32 15DK(微型板)正以随机方式转动4个LED。我不知道是否有可能做我想做的事情,如果可能的话,也可以调试器。我使用函数“SypTimeReStimeTime[ BTiKs””,其中BTiKS=20。是否可以实时调试睡眠ISR?我怎么知道一切都好,做我想做的事?谢谢你的反馈! 以上来自于百度翻译 以下为原文 Hi everyone, I'm debugging the Sleep ISR code I implement for knowing if it runs well!I'm using a ICE cube... I would like to do that the PSoC 1 sleeps during X time (20 seconds for example) and wakes up after this time to do an interruption rutine (1 Hz, choosen) to get data from ADC and save it in the eeprom. After the interruption, sleep another time... As I could see with the debugger is when the program starts goes to MC8 to sleep, when I pressed f5, goes to the interruption and when its has done, return to sleep MC8. In this moment, the ICE cube appears disconnect, but the board CY3215-DK (miniboard) was turning up the 4 leds like a random way. I don't know if is possible to do what I want and if is possible to debugger too. I use the function "SleepTimer_SetTimer(bticks)" where bticks=20. Is it possible to debug a Sleep ISR in real time? How can I know that all runs well and do what I want? Thanks for your feedbacks! |
|
相关推荐
10个回答
|
|
不幸的是,当执行M8CYSLID时,调试器断开连接。这是因为当处理器进入休眠状态时,IMO停止,调试器需要IMO来维护与POD的连接。为了调试,您可以用下面的指令替换M8CYSLAY指令。而(!)(IntCLR0&AM.MsK00Sead);M8CyCultIngFrand(IntCLR0,IntSK00Sead);该代码所做的是循环,直到产生休眠中断并清除在IntCLR0寄存器中的中断标志。完成调试后,返回M8CYSLAY指令。最好的问候,GSONH PSoC黑客
以上来自于百度翻译 以下为原文 Unfortunately, the debugger disconnects when M8C_Sleep is executed. This is because the IMO stops when the processor goes to sleep and the debugger needs the IMO to maintain the connection with the pod. For debugging you can replace the M8C_Sleep instruction with the below instructions. while(!(INT_CLR0 & INT_MSK0_SLEEP)); M8C_ClearIntFlag(INT_CLR0, INT_MSK0_SLEEP); What this code does is it loops till a sleep interrupt is generated and clears the interrupt flag in the INT_CLR0 register. When you are done debugging, put back the M8C_Sleep instruction. Best Regards, Ganesh The PSoC Hacker |
|
|
|
你好,
所以对你的快速反应很有帮助… 因此,正如现在配置的,IFIPWORDEBYA5VBooSpSoC会每隔20秒中断一次?我很喜欢这个函数:SaleTimeReStimeTime[BTiKs ]。如果函数产生它,或者使用SimeTimeReWaTimeTime[ BTiKs ],它对我来说并不清楚。BTICK=20,睡眠计时器=1Hz。我想要什么功能?我实现了第一个,因为我每天都花了8个小时,每一秒钟都要醒来,这是最大的价值。非常感谢你的反馈! 以上来自于百度翻译 以下为原文 Hello, So helpful has been your fast response ... Therefore, as it is configured now, if I powered by a 5V battery the PSoC would be an interruption every 20 seconds? I am using the function: SleepTimer_SetTimer (bticks). It is not clear to me if this function produces it or is better to use SleepTimer_WaitTimer (bticks). With bticks=20 and SleepTimer= 1Hz. Which function does what I want? I implemented the first one because I wanted the M8C sleep all the time and only every 20 seconds to wake up it to make a routine ... In addition, there is a maximum value of bticks? Thank you very much for your feedbacks! |
|
|
|
睡眠定时器用户模块不将处理器置于低功耗模式。它只使用睡眠定时器中断产生各种定时功能。不要混淆睡眠计时器的名称。睡眠计时器是一个时钟,可以运行在1Hz,8Hz,16Hz或64赫兹。睡眠计时器用户模块只是使用这个时钟并实现各种计时功能。为了让处理器睡眠20秒,这是一种方法,你可以采取。1。将全局资源中的睡眠间隔配置为1Hz。2。启用睡眠中断3。用一个可变的睡眠计来计算睡眠中断。您可以将此初始化为希望处理器处于低功耗4的休眠中断数。while循环使用如下代码:(1){BSLePeTek=20;同时(BSLEPTEK)!= 0){M8CySale:BSeLeTICK-;} //在这里编写代码,希望在上述代码中执行20秒},每1秒,处理器将唤醒并减少BSLePiTK变量。如果不是零,处理器就会回到睡眠状态。当变量变为零时,它将执行低于时间的代码(BSeLeTICK)!= 0)循环。希望这有帮助。最好的问候,GSONH PSoC黑客
以上来自于百度翻译 以下为原文 The SleepTimer user module does not put the processor to low power mode. It just uses the Sleep Timer interrupt to generate various timing functions. Do not get confused with the name SleepTimer. The sleep timer is just a clock that can be run at 1Hz, 8Hz, 16Hz or 64Hz. The SleepTimer user module just uses this clock and implements various timing functions. For letting the processor to sleep 20 seconds, this is one approach you could take. 1. Configure the Sleep interval in the Global Resources to 1Hz. 2. Enable the Sleep interrupt 3. Use a variable bSleepTick to count Sleep interrupts. You would initialize this to the number of Sleep interrupts that you want the processor to be in low power 4. Inside the while loop use a code like below: while(1) { bSleepTick = 20; while (bSleepTick != 0) { M8C_Sleep; bSleepTick--; } // Write code here that you would like to execute once 20 seconds } In the above code, every 1 second, processor will wake up and decrement the bSleepTick variable. If it is not zero, processor will go back to sleep. When the variable becomes zero, it will execute the code that is below the while(bSleepTick !=0) loop. Hope this helps. Best Regards, Ganesh The PSoc Hacker |
|
|
|
嗨,Graa,
再次感谢您的快速响应! 我跟你说的一样,但是我实现了一个ISR睡眠计时器。 我的代码类似于: 语用中断 空隙率(空隙) { //这里我输入了我想在SurrUp产生时做PSoC的代码。 睡眠; 返回; } 空隙主(空隙) { It BITKS=20; M8CyEnabeLeTimeMe掩码(IntMsK0,In MsK00Sead); M8CB; 睡眠时间; 睡眠时间启动; 睡眠时间定时器(BICKS); 韦勒(1) { M8Cl睡眠; } } 这个代码和你告诉我的一样吗?使用ISR睡眠计时器有什么不同? 谢谢你的帮助! 以上来自于百度翻译 以下为原文 Hi Graa, Thanks for your fast response, again! I did similar as you told me, but I implemented an ISR SleepTimer. My code is similar as: #pragma interrupt_handler SleepISR void SleepISR(void) { //here I putted the code I would like to do the PSoC when the interrup is produced M8C_ClearWDTAndSleep; return; } void main(void) { int bticks=20; M8C_EnableIntMask(INT_MSK0, INT_MSK0_SLEEP); M8C_EnableGInt; SleepTimer_EnableInt; SleepTimer_Start; SleepTimer_SetTimer(bticks); wile(1) { M8C_Sleep; } } Does this code do the same as you told me? What's the difference in using the ISR Sleep Timer? Thanks for your help! |
|
|
|
这种方法也能奏效。然而,在睡眠ISR中拥有完整的代码是不可取的。例如,如果在代码中有其他中断,这些中断将无法工作,因为在进入ISISIS时禁用全局中断。这就是为什么最好在前台执行所有代码的原因。
最好的问候, 加内什 以上来自于百度翻译 以下为原文 This method also will work. However it is not adviceable to have your complete code inside the Sleep ISR. For example, if you have other interrupts in your code, these interrupts will not work as global interrupt is disabled when the Sleep ISR is entered. That is why it is preferable to execute all the code in the foreground. Best Regards, Ganesh |
|
|
|
你好,
再次感谢你的帮助! 我告诉过你,因为我只有一个中断(睡眠中断),但现在我明白为什么你推荐我如何配置它,你是对的!另一件事,我想问你是否在你的代码(你的配置示例)不需要添加: M8CyEnabeLeTimeMe掩码(IntMsK0,In MsK00Sead); M8CB; 睡眠时间; 睡眠时间启动; 在你初始化BestePikk的值之前。我不知道是否是默认的或默认的。这是我最后的疑问… 谢谢你的快速回复! 以上来自于百度翻译 以下为原文 Hi graa, thanks again for your help! I told you that because I had only one interruption (Sleep Interruption) but, now I understan why you recommend me how to configure it, you are right! Another thing I would like to ask you if in your code (your example of configuration) is not needed to add : M8C_EnableIntMask(INT_MSK0, INT_MSK0_SLEEP); M8C_EnableGInt; SleepTimer_EnableInt; SleepTimer_Start; Before you initialize the value of bSleepTick. I don't know if is neccesary or is default. This is my last doubt... Thanks for your fast responses! |
|
|
|
对。对于我发布的示例代码,您需要使用M8CyEnabeLeTimeMebug(IntMySk0,IntMsK00Sead)来启用睡眠中断;M8CyEnabReBIT;但是,对于我建议的方法,不必使用SaleTimeToE用户模块。只需在设备编辑器中的全局资源中设置睡眠间隔为1Hz,并使用上面的代码启用中断,这就足够了。最好的问候,甘尼什
以上来自于百度翻译 以下为原文 Yes. For the example code I posted, you need to enable sleep interrupt by using M8C_EnableIntMask(INT_MSK0, INT_MSK0_SLEEP); M8C_EnableGInt; However, for the method I suggested, it is not necessary to have the SleepTimer user module. Just set the SleepInterval to 1Hz in the Global Resources in device editor and enable the interrupt using the above code and that should be enough. Best Regards, Ganesh |
|
|
|
嗨,Graa,
谢谢你的澄清!我将配置,而不使用模块睡眠计时器,你告诉我。那么,使用这个Mod(没有模块睡眠定时器)并用它来实现吗? 我想需要用户模块的主要原因是中断,而另一种方式只不过是一个时钟,不是吗? 谢谢你的支持! 以上来自于百度翻译 以下为原文 Hi Graa, Thanks for your clarification! I will configure without using the module Sleep Timer as you told me. So,is the same using this metod (without module Sleep Timer) and implementing with it? I guess that the main reason for needing the user module is for making interruptions and the other way is only as a clock, isn't it? Thanks for your support! |
|
|
|
亲爱的甘尼什
如果我用M8Cl睡眠代替 而(!)(IncLCr0&ApMySK00Sead);M8CyCurrim旗(ItnCLR0,In MsK00Sead); 在此示例代码中(睡眠定时器配置为125毫秒周期-在范围内测量): 当(1){M8CySalt;DeLi逆变换();} 对此: 当(1){同时(!)(IncLCr0&ApMySK00Sead);M8CyCultIn(IncLCr0,In MsK00Sead); 比代码运行非常不规则… 是正常的,还是出了什么问题? 当做 拉季姆 以上来自于百度翻译 以下为原文 Dear Ganesh if I replace M8C_Sleep with while(!(INT_CLR0 & INT_MSK0_SLEEP)); M8C_ClearIntFlag(INT_CLR0, INT_MSK0_SLEEP); in this sample code (sleep timer configured 125 msec period - measured on scope): while (1) { M8C_Sleep; LED_invert(); } to this: while (1) { while(!(INT_CLR0 & INT_MSK0_SLEEP)); M8C_ClearIntFlag(INT_CLR0, INT_MSK0_SLEEP); } than the code is runnig very irregularly... Is it normal, or something is going wrong ? Regards Radim |
|
|
|
由于无法在休眠模式下用冰块进行调试,因为连接到ICE丢失了,因此应该使用一些方法,例如使用定时循环、睡眠定时器或等待功能。
当你在调试和生产之间的代码部分会使你的生活更容易。 在第二种情况下,没有LED的代码会产生不同的效果。 如果你把完整的例子放在一个拉链的文件夹里,我们都可以看一看,试着更好地处理你的问题。 冰是凉的 鲍勃 以上来自于百度翻译 以下为原文 Since you cannot debug with an ICE-Cube during sleep-mode because the connection to the ICE is got lost you should do something instead, like using a timed loop, the sleep-timer or a wait-function. When you #ifdef those parts of code to distingush between debug and production will that make your life easier. The beaveour of the code snippets must be different in the second case there is no LED. If you post your complete examples here as a zipped folder we all can have a look at and try to follow your problems better. ICE is cool Bob |
|
|
|
只有小组成员才能发言,加入小组>>
754个成员聚集在这个小组
加入小组2110 浏览 1 评论
1858 浏览 1 评论
3673 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1791 浏览 6 评论
1540 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
575浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
428浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
440浏览 2评论
390浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
922浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-27 02:42 , Processed in 1.124438 second(s), Total 96, Slave 80 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号