Skip to content

Opening book details…

Can I read Timing is Everything on EtoBox?

Timing is Everything by Jon Williams is a book available to read on EtoBox.

What is Timing is Everything about?

One of the regular pokes taken at the Stamp is its lack of interrupts. A fair complaint perhaps, but not all micros have them and quite a few products are built with micros that don't. With a little bit of programming discipline -and a helpful second Stamp -we can write code that emulates a software interrupt. I recently converted a PIC-based (16F84) project to the BS2. The trickiest part of the conversion was the way I monitored the four sensor (switch) inputs. In the PIC, I have a software interrupt that causes the inputs to be scanned several times per second. With no interrupts in the BS2, I had to use a different method. It's simple, but not necessarily easy. The main code loop has to be fine-tuned so that no matter what path it takes, its execution time is always the same. Geez, how do we do that? The truth is that the process can be very tricky, especially with complex code (so we'll keep our demo simple). I believe the easiest way to write such a program is by creating a state machine. PBASIC makes this very easy with the BRANCH command. Let's say we want to monitor a couple of inputs and, if each is active beyond some threshold, we take an action. This doesn't sound like a

Author
Jon Williams
Language
EN
Rating
3.36 / 5 (47 ratings)
Updated
2026-03-14

More by Jon Williams

Browse all works by Jon Williams

Similar books