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





 

April 1998, Issue 93

Software Development for RTOSs


by Ingo Cyliax

A REAL-TIME EXAMPLE

So, enough of the theories. Let’s look at a real example. Remember the RC-servo–based robot controller I told you about last month for the six-legged Stiquito II robots? If you recall, I presented some sample code to illustrate the idea of interrupt latency.

To illustrate two kinds software development environments—target and host based—I ported the interrupt-based servo driver and gait generator to two popular RTOSs, Phar Lap ETS and QNX. While the original example also included a network-based command interpreter, I won’t worry about it for here. (I’ll save it for another column.)

I replaced the main module with a new module, test1.c (shown in Listings 1a–b), which does the necessary initialization and starts GaitThread(), which is implemented in module gait.c (see Listing 2).

GaitThread() is a high-level process, which computes the necessary patterns for the legs actuators. The RC-servo–based driver is implemented using an interrupt service routine in gait.c. Just like test1.c, ISRs are RTOS specific, so I have two versions, which are given in Listings 3a and 3b.