"Hypethreading"

Hey,

Is it's possible to have multiple C "subthreads"? If no, why not?
I know it is not a hardware feature :wink:

I would like to run a display, analog input and some serial data (temp&humidity sensor) every 0.2 s at the same time, without a big delay.

Hey maui,

Protothreads could be what you are looking for.

http://dunkels.com/adam/pt/

"Protothreads provide sequential flow of control without complex state machines or full multi-threading." -- Adam Dunkles

I would like to run a display, analog input and some serial data (temp&humidity sensor) every 0.2 s at the same time, without a big delay.

So, remove all the calls to "delay".
Only multicore processors can run things "at the same time", but you can do things fast enough that they appear to be at the same time.

Multi-threaded Real-time Operating Systems (RTOS) are the common solution to this problem. Many RTOSes are available and I have ported two free open source systems to Ardruino.

FreeRTOS http://www.freertos.org/ is very popular and ChibiOS ChibiOS free embedded RTOS - ChibiOS Homepage has some nice technical features.

You can download Arduino versions of these systems here http://code.google.com/p/beta-lib/downloads/list as FreeRTOSBeta20121215.zip and ChibiOSBeta20121212.zip. Install them and run the examples.

Here is a nice paper on FreeRTOS http://stiff.univ-brest.fr/~boukhobza/images/stories/Documents/Teachings/OSM/expo/FreeRTOS_Melot.pdf.