Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 23:43 17 May 2024 Privacy Policy
Jump to

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 Zealand
Posts: 9081
Posted: 04:43pm 09 Jan 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 3167
Posted: 05:36pm 09 Jan 2014
Copy link to clipboard 
Print this post

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 Zealand
Posts: 9081
Posted: 09:40pm 09 Jan 2014
Copy link to clipboard 
Print this post

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 Zealand
Posts: 9081
Posted: 10:09pm 09 Jan 2014
Copy link to clipboard 
Print this post

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


To reply to this topic, you need to log in.

© JAQ Software 2024