Sample Programs - WinSystems EBC-LP Operation Manual

Small, high-performance, embeddable computer system on a single board
Table of Contents

Advertisement

5.3
Sam ple Pro grams
There are three sam ple pro grams in source code form in cluded on the EBC-LP disk ette in the
UIO48 di rec tory. These pro grams are not use ful by them selves but are pro vided to il lus trate the us age
of the I/O func tions pro vided in UIO48C.
FLASH.C
This pro gram was com piled with Bor land C/C++ ver sion 3.1 on the com mand line with:
bcc flash.c uio48.c
This pro gram il lus trates the most ba sic us age of the WS16C48. It uses three func tions from the
driver code. The io_init() func tion is used to ini tial ize the I/O func tions and the set_bit() and clr_bit()
func tions are used to se quence through all 48 bits turn ing each on and then off in turn.
POLL.C
This pro gram was com piled with Bor land C/C++ ver sion 3.1 on the com mand line with:
bcc poll.c uio48.c
This pro gram il lus trates ad di tional fea tures of the WS16C48 and the I/O li brary func tions. It
pro grams the first 24 bits for in put, arms them for fal ling edge de tec tion, and then polls us ing the li brary
rou tine get_int() to de ter mine if any tran si tions have taken place.
INT.C
This pro gram was com piled with Bor land C/C++ ver sion 3.1 on the com mand line with:
bcc int.c uio48.c
This pro gram is iden ti cal in func tion to the "poll.c" pro gram ex cept that in ter rupts are ac tive and all
up dat ing of the tran si tion coun ters is ac com plished in the back ground dur ing the in ter rupt serv ice
rou tine.
Sum mary
The source code for all three pro grams as well as the I/O rou tines are in cluded on the ac com pa ny ing
disk ette. The source code is also pro vided in printed form in AP PEN DIX F. These I/O rou tines along
with the sam ple pro gram should pro vide for a good ba sis on which to build an ap pli ca tion us ing the
fea tures of the WS16C48.
Page 5-6
WinSystems - "The Embedded Authority"
EBC-LP OPERATIONS MANUAL
030530

Advertisement

Table of Contents
loading

Table of Contents