Protothreads & timers

How to build a simple timer system in protothreads

Often in an embedded application there is the need to wait for a certain time at a certain point in the program. Usually it is advantageous if the application can carry on doing other things while the time at the waiting point elapses. Protothreads offer very simple and elegant way of achieving this. In this article I will show you how I did it.

Read More

armand | Saturday 19 April 2014 - 11:23 am | | Programming, Embedded | No comments

Protothreads and locking resources

Using locks in protothreads to lock resources

In an application where I used protothreads, I had the need to control access to a resource of the microcontroller. In this case specifically the SPI bus, but it could be any of the microcontroller's other resources like a timer, UART, I2C etc. My solution was to implement a lock macro that allows your software to lock access to a resource.

Read More

armand | Friday 18 April 2014 - 11:33 am | | Programming | No comments

Protothreads

A novel way to implement multithreaded programs in small microcontrollers

From Adam Dunkels' website: "Protothreads are extremely lightweight stackless threads designed for severely memory constrained systems, such as small embedded systems or wireless sensor network nodes. Protothreads provide linear code execution for event-driven systems implemented in C. Protothreads can be used with or without an underlying operating system to provide blocking event-handlers. Protothreads provide sequential flow of control without complex state machines or full multi-threading."

Read More

armand | Monday 07 April 2014 - 4:16 pm | | Programming | No comments