EETimes

Embedded Systems October 2000 Vol13_11

Issue link: http://dc.ee.ubm-us.com/i/71842

Contents of this Issue

Navigation

Page 119 of 181

method is the fas test and easiest to use, but is also the hardest to change when the hardware changes. The sec- ond method uses an API [or direct I/O. This method is more flexible and ports more easily- to different hard- ware, but requires a slight addiLion in resources. Finally, the message method is an example of indirect I/O, whel-e the I/O is obtained using a messaging sys tem such as is found in OSEK/ VDX. This message meth od works well in a complex environme nt where data is obtained both from hardware and other devices. The cost is addiLional resources. The system model that will be used is shown in Figure 1. The operating sys tem, utiliti es, and physical layer chosen do not impact the I/O abstrac- tion directly and are not discussed here. The I/O layer is the basis of this article, and the impact to tlle applica- tion tasks is discussed. In the case of tlle message metllod, tJle I/O layer will be separated from the applicaLion tasks by a messaging system. ~7\\·7ofPi~~~o&ffii1 - - What will you create? Function name The fl.lllction name metJlod takes its name from me [act that a specific flolIlc- tion or set of functions is defined for each input or output. These functions provide me value of an input and set the value ofan output. In addition, sampling routin es need to be wl-itten for me inputs, and dl;ver routines need to be written fo r me outputs. The step requil-ed to use tllis metJlod are: • Defin e all inputs and outpu ts in me application • Defin e an access fun ction fo r each input and output. This may option- ally be a macro • Create the input sampling ro utines required fo r all types of inputs. Each routin e should ideally sample many inputs • Crea te the outpu t driver routines required fo r all types of outpu ts . Again, each routine should ideally dri ve many outpuLS • Create support routines such as debounce routines, filte ring, scal- ing, and so on. These may already exist in a library This metllod will allow reuse of appli- calion source code. Howevel~ me I/O layers will use borrowed code instead of reused code, with the borrowed code being re-written [or every applicaLion. Phar Lap Software, Inc. 60 berdeen Avenue LoalllOfIU"C. Phone: (6 17) 661-1510 Fax: (6 17) 876-2972 intc)Ilil'Jhariarl.com Providing Realtime Solutions for the Embedded World. Define inputs and outputs The first step in applying this me thod is to defi ne all the inputs and o utpu ts to the system. These may include digi- tal inputs and outputs such as switches and lamps, analog inputs and outputs 118 OCTOBER 2000 Embedded Systems Programming

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems October 2000 Vol13_11