circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

July 2006, Issue 192

Precision Motion-Sensing System Analyzer
Philips ARM Design Contest 2005 Winner


The Buckymeter’s software is conceptually simple (see Figure 4). Think of a digital tape recorder. There are the controls and the storage medium. The Buckymeter operates a slow main loop that operates as the controls. A fast loop operates the storage medium. The devil is in the details!

(Click here to enlarge)

Figure 4—The Buckymeter software is built from two simple control loops.

The main loop initializes the system and then executes once per second. Inside the loop, user commands are executed and interface I/O is controlled. The I/O consists of an isolated output and switches to start and stop recording.

It isn’t necessary to service the user any faster than this 1-s interval. Commands are received by a serial communications interrupt or an input capture interrupt. The ISR sets flags to indicate the command(s) selected. Those commands are actually used during the 10-ms interrupt. So, the commands are received by ISRs and latched for processing by the control loop. One second or less before the command executed seemed an acceptable compromise to allow for the simplicity of creating a single background task.

The recording and playing processes are similarly forgiving. It takes much longer than 1 s to free a bull from his pen after Record is pushed. An extra 1 s of data after the run isn’t a problem.

The fast loop is where most of Buckymeter’s work is done. Timer1 controls the fast loop by generating an interrupt request (IRQ) every 10 ms. It is programmed as the highest priority interrupt. Originally, the fast interrupt (FIQ) was used for this interrupt, but after I got numerous headaches trying to allow the timer capture interrupt (and only the timer capture interrupt) to nest within the FIQ, I changed the code to assign FIQ to the pulse capture. The normal VIC operation allowed this interrupt nesting.

The fast loop updates a set of counters that act as asynchronous timers for slower loops in the system. The fast loop also executes the data collection.

The unused flash ROM in the LPC2138 provides secondary storage. Run-time programmability makes this an ideal storage medium for a compact system design. I referred to chapter 19 in Philip’s “LPC2132/2138 User Manual (Preliminary Release)” as I developed the software.