beautypg.com

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

Page 46

background image

Chapter 5

Startup, Status, and Shutdown

5-3

value of 0 for this argument defaults to the factory-selected paragraph
address of C000h. Switches on the board are set to determine the global
RAM’s address in the host’s memory space, as explained in chapter 3,
Installation.

packet:

a QMR packet, (see chapter 7, Scanner Management) into

which setup_6008 returns the autoconfigure information, or status in
case of error. Note that the argument is a pointer to the packet.

Returned values:

status: an integer: SC_OK 0(hex) if the setup proceeded without error,

C_AUTOCONF 10(hex) if the initial autoconfigure failed, C_SETUP
13(hex) if the setup call (changing baud rate or resistor) failed; any
other value means that the initial sync with the scanner failed.

If the returned value is SC_OK, your program’s packet contains the

information regularly returned by an autoconfigure.

If the returned value is anything but SC_OK, the specific nature of the

error is in the qmr_stat field of the packet that you passed to
setup_6008.
Your program should display status information and abort
immediately.

Here’s the start of a sample program, showing a call to setup_6008 and
associated checks for error:

#include
#include
void main( )
{
QMR pkt;
int status;
. . .
status = setup_6008(-1, -1, -1, 0xC400, &pkt);
if ( status != OK ) {

printf(“setup failed: command=%s status=%s\n”,

xlat_cmd(status), xlat_conf(pkt.qmr_stat));

if ( status != C_AUTOCONF && status != C_SETUP )

printf(“scanner fatal error %d\n”, fatal_6008(
));

abort( );

}
else
mr_print(stdout, C_AUTOCONF, &pkt);
. . .

The declaration, QMR pkt, is explained in chapter 7, Data Structure.