Cooperative Multitasking. A web-based article on a technique to implement CMT on tiny microcontrollers.

Part 1 describes the building blocks; part 2 has embellishments and methods to keep your code clean.

Pat Beirne 6ffc8722fa edit prose, fixups 3 tuần trước cách đây
build f83c0bc355 changed all timers to count-down, prose cleanup 1 tháng trước cách đây
CooperativeMultitasking.md 6ffc8722fa edit prose, fixups 3 tuần trước cách đây
README.md e01c1b971a remove .html file and move the main link out of gogs...into nginx 1 tháng trước cách đây
beer_vat.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
beer_vat.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
blb.jpg 524ef93dc0 Add link in the README, add photo of the button/light board. 1 tháng trước cách đây
c.xml f3ad6ca5d3 changed uint8 to uchar (it looks nicer) and cleaned up postMessage/sendMessage 4 tuần trước cách đây
dispatch1.jpg a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
dispatch2.jpg a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
door.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
door.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
door2.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
door2.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
fridge_state.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
fridge_state.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
led_state.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
led_state.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
led_state_simple.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
led_state_simple.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
makefile 0ede4e93ad introduce init.md, grammer fixes, center author, temp-control state machine 3 tuần trước cách đây
pandoc.css 0ede4e93ad introduce init.md, grammer fixes, center author, temp-control state machine 3 tuần trước cách đây
postMessage.png f3ad6ca5d3 changed uint8 to uchar (it looks nicer) and cleaned up postMessage/sendMessage 4 tuần trước cách đây
radio_tuner.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
radio_tuner.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
rtb_state.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
rtb_state.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
rtb_state_2.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
rtb_state_2.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
rtb_state_3.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
rtb_state_3.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
rtb_state_4.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
rtb_state_4.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
rtb_state_5.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
rtb_state_5.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
sendMessage.png f3ad6ca5d3 changed uint8 to uchar (it looks nicer) and cleaned up postMessage/sendMessage 4 tuần trước cách đây
uart.md 2cd4f9d523 fixup in uart.md (clean code, erase comments, grammar) 3 tuần trước cách đây
up_down.dot ca8b4d46e1 add up_down.dot 3 tuần trước cách đây
vending.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
vending.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
window_complex.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
window_complex.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
window_state.dot a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây
window_state.png a842113249 Major release, lots of graphics, the text flows better now 1 tháng trước cách đây

README.md

This is a web-based article describing cooperative multitasking, also known as event driven programming. The method described here is small enough to fit on many sub-$1 microcontrollers, those without memory management units. Examples are the STM32, STM8, PY32, AtMega, AtTiny, 8051 and Pic microcontrollers.

With this code structure in place, these tiny microcontrollers can be made to perform multiple separate tasks, apparantly independent from each other.

The reader is walked through the elements of the build, and is then given a fully-implemented block of code. The 2nd half of the article builds on the basis, with lots of examples of state-machines and modifications to allow for cleaner code.

The audience for this article is anyone interested in writing code for small micro-controllers. A background in any programming language would help (C, Rust, Python).