beautypg.com

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

Page 47

background image

Chapter 5

Startup, Status, and Shutdown

5-4

Look at the call to setup_6008. The first two arguments select the default
baud rate (57.6 Kbaud) and resistor setting (connected). The next two
arguments give the default interrupt request line setting (IRQ3) and the
paragraph address of the scanner, C400 (hex), which corresponds to C400
in the table in chapter 3, Installation. The fifth argument points to the
packet, which contains autoconfigure information if setup was successful
and an error code if it was not.

Next we test the status returned by setup_6008. If it’s not equal to OK (or
SC_OK; the two constants have the same value), we have a problem. In
this case the status is the number of the command that failed, and we
display a message using the translation routines described in chapter 9,
General Support Features, and chapter 7, Scanner Management. If the
status is neither C_AUTOCONF not C_SETUP, the host was unable to
establish communication with the scanner and the fatal_6008 routine gives
a code for the reason. If we couldn’t complete the setup operations, we
abort execution of the program.

NOTE: A common error returned from the fatal_6008 function is error
code 102. This usually means the RAM address set with the dip switches
on the scanner does not agree with the address argument in the setup_6008
function. Code 102 can also mean an addressing conflict with other
hardware in your PC. For most PC’s D800(hex) is usually free. Also
make sure the bus speed of your PC is not running faster than 8 Mhz.

If the setup operation did succeed, the host and the scanner are now talking
and your application program can proceed. In this example, we use
mr_print to display the initial configuration information.

The scanner is in program mode upon startup, and you’ll probably want to
change to run mode. For that procedure, see Set Operating Mode in
chapter 7, Scanner Management.