beautypg.com

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

Page 73

background image

Chapter 7

Scanner Management

7-6

Set Operating Mode

To change the scanner’s operating mode, you must set the first byte of the
packet’s qmr_data field to one of the three values CM_RUN, CM_TEST,
CM_PROGRAM
. Then call mr_wait with C_SETMODE as its first
argument.

Calling sequence:

packet.qmr_data[0] =

mode

;

status = mr_wait(C_SETMODE,

&packet

);

where

packet

is a QMR type packet. Note that the argument to mr_wait is a

pointer to the packet.

mode

is either CM_PROGRAM, CM_TEST, or CM_RUN.

Returned values:

status and packet.qmr_stat as explained under General Form, above.

global

variable

g_op_stat

reflects the new scanner operating mode if the

request was successful.

Example: To change to run mode, execute the following code:

QMR mode_pkt;

. . .

mode_pkt.qmr_data[0] = CM_RUN;
if ( mr_wait(C_SETMODE, &mode_pkt) ) {
printf(“can’t execute set mode (%s)\n”,
xlat_conf(mode_pkt.qmr_stat));
abort( );
}

For the xlat_conf function, which translates a confirmation status to
English, see Confirmation Status Codes later in this chapter.