Real Time programming

Hi all

I sit rally necessary to use RTOS functions for real time solutions , or is it better to write c code based on combination of polling and interrupts routines ?

Please explain with some example/s .

Thanks in advance Elico

What, is this an assignment? YOU give an example of what you are trying to achieve.

It is a general question at the basic level.

Thanks elico

It is a general question at the basic level.

Then the general answer is:

RTOS should be used when RTOS is appropriate.

elico: I sit rally necessary to use RTOS functions for real time solutions , or is it better to write c code based on combination of polling and interrupts routines ?

Please explain with some example/s .

Right ...


http://arduino.cc/forum/index.php/topic,96430

elico: I am looking for details on a new rtos for embedded systems called uRTOS .


http://arduino.cc/forum/index.php/topic,91283

elico: To my opinion that is easy to be done by skillful C programmers .

Also there are many RTOS out there that can use as a start and ideas source .


http://arduino.cc/forum/index.php/topic,91181

elico: Is there any multi threading library for arduino ? Or any RT OS that is suitable for arduino and will enable multi threading ?


http://arduino.cc/forum/index.php/topic,91169

elico: what is unique for arduino for linux ? http://arduino.cc/en/Main/Software

Does it supprt linux things like multi threading ?


http://arduino.cc/forum/index.php/topic,91130

elico: Is it possible to do multi threading in the arduino C code like in linux based embedded boards ? If yes how ?


This is a massive cross-post. Try asking that question ONE MORE TIME and see what happens ...

Many things are possible on Arduino, what is more important is What do you really mean by "REAL TIME"?

Most of what we do on Arduino is "Real Time" in that we are looking at some input(s) and from that determining what to do with some output(s). When run in a tight loop the response time is very short and the results are in "Real Time".

If you want to do dozens of inputs and based on those inputs the set dozens of outputs then the Arduino may not be the best platform as there is only so much RAM to store values in and still keep the stack from clobbering those variables.

"Real Time" can mean many things. I have worked with PLCs, which are a specilized computer oriented towards processing discreet inputs and outputs. ON one of the older ones we always kept track of cycle times - as I remember we were getting 535 times through the program every second. That was more than enough to keep up with the machines and was "Real Time". If your process runs in the microseconds then that kind of "Real Time" may not be adequate.

Do you need the complexity of a "Real Time" operating system? Is the Arduino the best package for "Real Time"? Might you be able the go to assembly language on the Arduino and reduce the processing time to accomplish the same thing that a "Real Time" OS might provide?

"Real Time" is a buzzword that still requires that you do a lot of work to optimize the operation, and the more critical the function, the more carefully it must be optimized. A RTOS WILL NOT perform miracles with poorly written code, and may actually perform worse because of the added overhead of the RTOS. An RTOS uses resources and on the Arduino, because of the design of the ATMega328P there is limited RAM and that is the resource that limits the functionality of the Arduino.

I coded a Stepper controller in Arduino and Assembly. The Arduino version was easier to troubleshoot, but the more resources were required. 1200 bytes of flash and a couple variables in RAM. Coded in Assembly 88 Bytes of flash and NO variables stored in RAM, was able to store it all in registers. Only RAM usage was the return address from an interrupt.

The easy way to do a delay is Delay(), but it pauses execution of the program, the "Real Time" way is to use Millis() and add complexity by processing the delay times yourself.

Many thanks kf2qd Regards to the global moderator as well , may he be more calm ..

Elico

elico: Regards to the global moderator as well , may he be more calm ..

You have asked the same, or virtually the same, question at least 6 times now, in February, March and May this year. Each time someone thoughtfully answers you. I asked you a while back to please state what you are trying to achieve and stop asking (three times by then) for more details about an RTOS and you need "fast and exact action".

[quote author=Nick Gammon link=topic=91181.msg684817#msg684817 date=1328828406] Other threads:

http://arduino.cc/forum/index.php/topic,91169 http://arduino.cc/forum/index.php/topic,91130

Also:

elico: I need fast and exact actions to be taken .

elico: Is it possible to insert assembly code within the C code ?

OK enough of this mumbo-jumbo. You want multi threading. You want fast and exact actions. You want assembler.

What are you doing exactly that requires all this?

Sounds like you are working on the solution, but don't have a problem. [/quote]

I am calm, and if you ask the question again I am going to calmly delete it.

OK Elico