I have a large program ( 5000 lines) that reads data from external sensors, talks to a modem, connects & downloads larges files to a server, gets server RTC, reads & writes to an SD card, and looks at several external digital I/O.
The main loop looks at the RTC and generates a [u:f450fd02a6]flag[/u:f450fd02a6] every 15 minutes to trigger a server connection & download. this MUST happen.
The problem I forsee is that if the processor gets tied up in trying to TCP connect or download to a server or whatever - because these things can take a long time and I cannot predict how long such a process may take, there may be times when my [u:f450fd02a6]flag[/u:f450fd02a6] doesn't get set because the processor is busy when the 15min tick happens. Setting [u:f450fd02a6]theflag[/u:f450fd02a6] in my RTC int routine doesn't help because even though the flag gets set at the correct time, it may not get 'discovered' until too late 1 or 2 minutes later.
SO - I need to be able to globally haul my sequence from whatever it is doing, back to square 1 and say " forget what you are doing - this is more important. Go and read the sensors NOW"
I could look at the flag in every single one of my subroutines, but that's clumsy. State machine?
[b:f450fd02a6][color=red:f450fd02a6](BASCOM-AVR version : 2.0.7.7 )[/b:f450fd02a6][/color:f450fd02a6]
↧