Flowchart for using the api, Application example – Comtrol API (6508) for the MS-DOS User Manual
Page 11
![background image](/manuals/672111/11/background.png)
Developing Applications
11
Developing Applications
•
900 - 943
•
D00 - D43
This is normally of no concern because
ISA
peripherals often use only 10 bits of
I/O
addressing, meaning they are limited to addresses below 400h.
Note: In order for your application to locate the configuration file, the
ROCK-
ETCFG
environment variable must point to it. This is done with the
DOS
SET
command, usually placed in the
AUTOEXEC.BAT
file.
2.4. Flowchart for Using the API
This subsection contains the steps required to write and execute an
application program using the
API
. Each of these steps are described in detail
in the following subsections.
The remainder of this chapter assumes that the
API
is installed in a directory
named
\ROCKET
, and that you will place your application source code in a new
directory called
\ROCKET\CUSTOM
.
You may wish to create your own directory structure for source code. In that
case, these instructions and the make files must be adjusted accordingly. A
complete application demonstrating the use of the
API
is provided in the
\ROCKET\SAMPLE
directory.
Flowchart 2-1. How to Use the
API
2.5. Application Example
The following application corresponds to the previous flowchart and the
following subsections explain specific steps in detail.
#include
#include
#include
#include
#include
#include "api.h"
Step 3
(2.6)
main(void)
{
unsigned int InitReturn;
char Buf[80];
int i,Dev,Cnt,Err;
Step 1
Create a new subdirectory called
\ROCKET\CUSTOM
.
Copy the appropriate make file from the
\ROCKET\SAMPLE
directory into the
\ROCKET\CUSTOM
directory.
Step 2
Write the application source files. Make sure that
you provide #include statements for the
API.H
file.
Step 3
The first action in the main() is to call the
aaInstallCtrlCHandler() and aaInit() functions.
Step 4
Write the remainder of your application using
API
calls to access the serial devices as needed:
* Open, reconfigure, and close
* Write and read serial data
* Modem control outputs
* Receive and modem change events
Step 5
* Call aaExit() before leaving the application
Build the application.
Step 6
Execute the application.
Step 7