Multi Task


#1

Hi

I am working on a weather station aplication. I need to do 3 tasks at the same time. One task does not have to stop the other, is this posible?
1- Recieve sensors data from serial port every 5 minutes and store them in memory
2- If there is data in memory that has not been sent, send it to a server in internet through gprs. If the server is down keep trying until it gets through.
3- If the modem (fastrack) receives a SMS, send an SMS to the same number from the first SMS with the last data gathered from the sensors.
I cant see how I can make them all work toguether at the same time. For example if the modem is trying to send the information to the server, how is it going to be ready to recieve an SMS and run task 3?

I would really apreciate your help.
Thanks in advance.


#2

Hiya,

You didn’t mention which CPU/Module you are using.

Yep - if you are using the Q2686 module or a Q2686 based modem. Have no experence with any others.

In the Oasis 2.xx (R7.x OS) samples there are some examples that will show you how to do this. Also check out the Oasis 2.xx API documentation.

I’m doing a similar thing in one of my apps. I’m currently running about 9 ‘threads’ that are nominally independant using the multitasking API on both the Q2686H and Q2686G modules.

As I understand it, this is NOT possible if you are still running the 6.xx OS firmware…

ciao, Dave


#3

Actually, you don’t.

Open-AT is entirely Event-Driven; your event handlers are called whenever there is something to be done - and only when there’s something to be done.

Thus Open-AT effectively does the “multi-tasking” for you!

So that only happens once every 5 minutes.
So you have a 5-minute timer to trigger the process, and the data transfer is handled via FCM events.

Again, all event-driven

You receive the SMS via an event handler, and control sending via events

You don’t - Open-AT does it for you

Open-AT “queues” the events for you


#4

Thank you very much for your response, its been very helpfull.

I have another question. Hope you can help me, as I dont have much experience with these modems.

I want to connect the modem (I still do not no which one is best for my aplication, I would appreciate your opinion. As for now I am between a q2686 or directly a Fastrack supreme 20) to this 3 things:
1- Serial input from sensors. I am thinking of a microcontroler that gathers information from all sensors and sends the info to the modem via a serial input.
2- Serial output to LCD display.
3- Serial PC connection. This connection does not necesarily have to be available all times. I am just going to need this one to upgrade the embeded software from time to time. The best for me would be to have all three connections available all times but It would not be so bad to not have the LCD display (for example) when I am using the PC connection.
Can I do this with the q2686 of Fastrack supreme? Can I use 1 serial connection for these three purposes? Any ideas? I feel a bit lost. Would I need to multiplex the serial connection?

Thank you again


#5

A Fastrack Supreme with the GPIO+UART+USB IESM fitted would give you 2 UARTs and USB:

  • Use 1 UART for the serial interface to the microcontroller;
  • Use 1 UART for the LCD serial interface;
  • Use the USB for the PC connection.

Or, if you’re going to use a microcontroller anyhow, you could use that for the LCD and PC interfaces, and just have the GSM unit do the comms stuff…


#6

Note that the Q2686 also provides 2 UARTs and USB - so it just depends if you have the resources to do the extra hardware design!

In fact, the Fastrack Supreme is just a Q2686 in a ready-to-go box…