Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 21:41 25 Nov 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 : Button INT and timer

Author Message
vk4tec

Senior Member

Joined: 24/03/2012
Location: Australia
Posts: 239
Posted: 12:59pm 27 Apr 2012
Copy link to clipboard 
Print this post

Hello

I am working on a GPS project

At the moment I am looking for a button press when the NMEA sentences are rolling past.

What I would like to do is make the button trigger an interupt, and simply increment a number.

Can someone help me understand the logic and some code to handle a button interrupt.

//

Also is there a way to run a tick timer in MMbasic ? like a master loop ?

At the moment when there is no GPS nothing happens.

My code is relying on the GPS coming in to do things.

Is there such a thing as a time out timer ?

How would you hand the lack of serial data ?

I would like to say "GPS DATA ERROR"

Maybe I can check the Serial Buffer ?

Best way to handle "NO COMM" situation ?

- Andrew -
Edited by vk4tec 2012-04-28
Andrew Rich VK4TEC
www.tech-software.net
 
vk4tec

Senior Member

Joined: 24/03/2012
Location: Australia
Posts: 239
Posted: 01:09pm 27 Apr 2012
Copy link to clipboard 
Print this post

I tried

SETTICK 500, screen

screen:
printlcd 1, "data"
IRETURN

"Error: Return from interrupt when not in an interupt"
Andrew Rich VK4TEC
www.tech-software.net
 
vk4tec

Senior Member

Joined: 24/03/2012
Location: Australia
Posts: 239
Posted: 01:26pm 27 Apr 2012
Copy link to clipboard 
Print this post

Interseting

SETTICK 100, screen

Does not allow enough breathing space for the NMEA parse to happen.

SETTICK 500 does.

- Andrew -
Andrew Rich VK4TEC
www.tech-software.net
 
James_From_Canb

Senior Member

Joined: 19/06/2011
Location: Australia
Posts: 265
Posted: 12:20am 28 Apr 2012
Copy link to clipboard 
Print this post

The "interrupt return" error is because your code sets the interrupt then processes the next instructions. When it reaches the IRETURN it gives the error message because it wasn't called by an interrupt.

You need a block of code before the screen label that ensures the screen routine is only called by an interrupt. For example, an endless loop.

James

  vk4tec said   I tried

SETTICK 500, screen

screen:
printlcd 1, "data"
IRETURN

"Error: Return from interrupt when not in an interupt"

My mind is aglow with whirling, transient nodes of thought careening through a cosmic vapor of invention.

Hedley Lamarr, Blazing Saddles (1974)
 
vk4tec

Senior Member

Joined: 24/03/2012
Location: Australia
Posts: 239
Posted: 12:42am 28 Apr 2012
Copy link to clipboard 
Print this post

Thanks James

I moved the code outside the LOOP

Works fine


Andrew Rich VK4TEC
www.tech-software.net
 
Print this page


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

© JAQ Software 2024