Rockwell Automation 6008-SI IBM PC I/O SCNNR 6008-SI User Manual
Page 36

Chapter 4
Programming Overview
4-9
Defined Constants
In their appropriate places in this manual we’ll tell you about various
constants defined in the header file H_6008SI.H. There are three
constants that are not used by our routines but are defined for your
convenience, and we’ll list them now:
MAXGROUP is the maximum number of module groups, 64. Groups
in the I/O image tables are therefore numbered from 0 to
MAXGROUP-1.
MAXMOD is the maximum number of modules or slots, 132.
MAXADAPT is not the maximum number of adapters (which is 16) but
the number of possible adapter addresses, 32. (An adapter address is the
same as a quarter-rack address, 8 x rack +group / 2.) For instance, when
specifying fault dependent groups (chapter 7, “Scanner Management”)
you’ll give MAXADAPT group numbers to account for everywhere an
adapter might be addressed.
Defined Type Bool
It’s convenient to think of several variables and function values as
Boolean: that is, their value can be only true or false. We define the type
Bool for such values. Bool is equivalent to int, but use of a specially
defined type provides better program documentation.
We also define the two Bool constants OK and NOT_OK, equivalent to 0
and 1 respectively. This definition reflects the C language convention that
0 indicates no error and a nonzero value indicates an error.
Several library routines return status of OK or NOT_OK, and you can also
use those constants in your program. An example is presented in the user
diagnostic program source code, which we explain next.
Extended Example
Your distribution disk contains a complete sample program that exercises
all aspects of the scanner operation through commands you enter from the
keyboard. (Chapter 10, “User Diagnostic Program,” is a user’s guide for
the U_D1 program.)
Please take a minute to look at the source code for the main module,
U_D1.C. The program includes header files STDIO.H and H_6008SI.H
indirectly, through header file U_D1.H.