Computing stuff tied to the physical world

Timer Interrupts

In AVR, Software on Dec 6, 2008 at 15:33

Here is some new interrupt-driven receiver code. This receiver is considerably better at identifying correct packets, regardless of what other bit patterns are coming in. The new code is based on a state machine which takes pulse times and gaps into account, detecting all valid sequences of pulse widths and rejecting all outliers. The main code is:

AA4D1C74-E3E3-41B7-BD67-90E432711496.jpg

Then, in the main loop, this code picks up the results:

EFC8BB55-ECC5-4553-9C8D-17CB1F9A92CC.jpg

Also, with an interrupt driven design the receiver no longer depends on timing loops and is free to spend its time in other logic. It is now possible to run multiple state machines in parallel, decoding a variety of different signal patterns.