Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Changing MODEs kills SETTICK?
Author | Message | ||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9308 |
Hi all. From what I can tell, if you set a mode, say, MODE 4, then set some timer interrupts with the SETTICK command, if you change mode, all the tick timers are cancelled. Is this normal? I cannot find anything under the MODE command in the manual(page 27 of 4.4B manual) that indicates that this will happen. If it is normal, that's fine - I would just like to know if it is. If that is indeed normal, I will just have to move my setick timers to a gosub of their own, and call them as soon as I change modes. No big deal, just wondering is all.... Smoke makes things work. When the smoke gets out, it stops! |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
I suspect that something must be wrong with your program. I ran the following test and the tick interrupt kept ticking. Mode 3
SetTick 1000, DO_TICK Do If Inkey$ <> "" Then Mode 4 : Print "Mode changed" Loop DO_TICK: Print "tick" IReturn Geoff Geoff Graham - http://geoffg.net |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9308 |
Yes, I ran this and came to the same conclusion. I did re-write your SETTICK to SETTICK 1000, DO_TICK, 1 so that I was specifying one of the four tick timers, as I thought that might be linked to that, but it worked fine. I will have an in-depth look at my code for a bug - if the SETTICK is supposed to keep working regardless of the mode, then it must be something in my code, as you say. I will post back when I find the problem. Smoke makes things work. When the smoke gets out, it stops! |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9308 |
How to bollocks up some code 101: Call an interrupt, then don't return it... Smoke makes things work. When the smoke gets out, it stops! |
||||
Print this page |