Designing an embedded multitasking program using Protothreads