Hi guys, I have a really weird problem and I cannot lay my finger on it!
Basically, I want to send serial data on specific timeslots within a second. The seconds are synchronised by a Pulse-per-second signal that comes out of a GPS receiver. What I want to do is toggle a led on and off every time a pulse is received.
I do this using an interrupt on digital pin 3 (interrupt pin 1) on my Duemilanove. It works like a charm when I disable all the code in the loop() procedure, but when I re-enable all the code, it seems to work only once and after that, it just stops toggling on and off.
Although the code in my loop() statement hasn't been debugged and could very well have some logical errors in it, I don't get why the interrupt routine doesn't work. I thought that, wherever the program is, the interrupt routine should be executed when the interrupt is detected. I'm not using any delay() functions.
I stopped reading your code when I encountered the first goto in the code. Goto is a statement that can easily corrupt stack and heap administration so it should not be used (or at least with the greatest possible care).
I'll have a look at the code ... to check how to rewrite it properly.
With the phrase containing '44' I'm looking for the position of the "," sign inside the serial data that comes from the GPS. It's transmitted as NMEA data:
With the komma, I'm seperating the different information in the string. There's a parameter which tells me if there is a GPS lock which I need to determine if the timing is still accurate.
Note that arrays start with index 0 in C so an array kommas[6] has index 0..5 !!
You are the man!!
Nice. It works now! Turns out that I was trying to assign values to non-existing members of an array. I guess that made everyting stop and the interrupt wasn't even called once, which put me on the wrong foot. Man, that took me all day to figure out!