beautypg.com

Writing your program – Rockwell Automation 6008-SI IBM PC I/O SCNNR 6008-SI User Manual

Page 34

background image

Chapter 4

Programming Overview

4-7

In chapters 5 through 9, we’ll explain the details of writing application
programs to communicate with the scanner. But first we’ll give you a
bird’s-eye view.

Header Files

Every source program must contain these two lines:

#include

#include

STDIO.H is the standard header file supplied with your compiler.
H_6008SI.H is supplied on your scanner driver disk and defines constants,
variables, and functions that your program needs.

Your program may need other header files in addition to these two. If so,
you can add #include lines before or after the reference to H_6008SI.H.
However, H_6008SI.H must come later in your source file than STDIO.H.

Program Skeleton

Before making reference to any other routines in the scanner driver library,
your program must call either setup_6008 or start_6008 as described in
chapter 5, Startup.

After the last reference to other library routines, but before exiting, you
must call the stop_6008 function; please see the “Shutdown” section of
chapter 5. If your program crashes or exits normally without calling
stop_6008, you may have to reset the host computer (

Ctrl-Alt-Del

or

cycle power) to continue operating.

Between the startup and shutdown calls, your program must use the
host_active macro to tell the scanner that your program is still active.
By default, your program must do this at least once a second, but you can
change the interval through programming. For full discussion of safety
issues and programming, please see chapter 5, Host Watchdog.

Writing Your Program