EETimes

Embedded Systems October 2000 Vol13_11

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

Contents of this Issue

Navigation

Page 131 of 181

i J in an array named digitaL in. This array will be u ed later in the access and sample routines. Only one instance of this macro should exist in the configuration file. The ROM macro defines the con- stant structure for each digital in put. Each digital input will have one instance of this macro and it will be referenced by the unique identifier name. The member port is a global name that has been defined elsewhere and is specific to the microco ntroller being used. The debouncetime argu- ment is the number of samples to debounce the input. posi tion and rarrrnask is the offse t posluon in the RAM array and the mask of the digital input in the packed RAM. The combi- nation of position and rarrrnask must exist only once in the configuration fil e. Finally, defauLt is the default value that will be used in the RAM array for that input. Create access, sample, and driver routines The access fun ctions should be gener- ic and allow multiple inputs or outputs to be accessed using the same inter- face, with a different argument. For instance, GetDi screteState, shown in Listing 10, is used to unpack all dis- crete inputs from a digital input. To expand to analog-based digital inputs, the routine would have to determine the type of argument that has been sent in the paramete r list. This wo uld require an additional parameter or structure that contains the type of the input. For simplicity, assume tha t GetDi screteState will only return data on a digital input. This function is called by passing Our inspiration. PowerfuL tooLs. Great productivity. Integrated price. Paradigm introduces all the tools you'll need for x86 integration in one package. Paradigm C++ is alone in offering a complete integrated development environment that includes all the tools you need to get your x86 embedded application jump started. Editing, project management. debugging, compiler, assembler, version control and more, all fully integrated into the powerful Paradigm C++ development environment. If you are tired of wasting time on non-integrated tools, then Paradigm C++ is where you want to be. Download a copy of Paradigm C++ from http://www.devtools.com/pcpp and see the future of x86 development tools today. Paradigm Paradigm Systems 3301 (ountry Club Road Suite 2214 Endwell. NY 13760 1-800-537-5043 Phone 607·748·5966 Fax 607·748-5968 info@devtools.com http://www.devtools.com 130 OCTOBER 2000 Embedded Systems Programming th e address of the ROM constant structure to the fun ction. In this inter- face, the debounced value of the digi- tal input is extracted from the RAM packed array. INACTIVE is returned if the bit is 0, othe rwise ACTIVE is returned. The sample routine is quite diffe r- e nt from the one in the fun ction name method, since it is more generic and needs to pack the inputs differently. The ge ne ri c ro utine is shown in Listing II. In th is fun ction, the address of the ROM constant structure is passed and used to sample and extract the data from the digital port. The [-esulL is either ° if low or no n-zero if high. The routine, DebounceDi screte, will use tile raw data to debounce the input. Create each instance in configuration me A configuration fi le with a name such as iocfg . h needs to be created for tile application. This fil e is included in the

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems October 2000 Vol13_11