beautypg.com

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

Page 75

background image

Chapter 7

Scanner Management

7-8

Example: If you want to switch to 115.2 Kbaud without changing the
resistor setting, use this code:

QMR setup_pkt;

. . .

setup_pkt.qmr_data[0] = 2; /* baud multiplier */
setup_pkt.qmr_data[1] = -1; /* no change to resistor */
setup_pkt.qmr_data[2] = 0; /* not in debug mode */
mr_wait(C_SETUP, &setup_pkt);
if ( setup_pkt.qmr_stat ) {

printf(“setup call failed (%d)\n”,

setup_pkt.qmr_stat);

abort( );

}

A note on debugging mode: Normally, the scanner expects the host to
return the global RAM within 50 milliseconds after the scanner interrupts
the host. (This is a comfortable margin: the host interrupt service routine
takes about 0.1 to 2 ms, depending on the host CPU and how much work
the interrupt routine has to do.)

After the 50 ms interval, the scanner watchdog kicks in. What that means
is that the scanner decides that the host hardware or BIOS has died and
therefore the scanner goes off the I/O link. In about another 50 ms the
adapters all go inactive and the modules are in last state or reset according
to the way you set their switches. Normally, this safety precaution is
exactly what you want.

But if you’re debugging your program you may want to single step through
it, and each step would take longer than the scanner’s 50-ms watchdog
interval. This is the purpose of debugging mode: it turns the scanner
watchdog off.

Make sure to turn debugging mode off (a setup request with any value
other than 1 in the third byte) before your program exits. If your program
ends while the scanner is in debugging mode, you have to cycle power
before the scanner communicates with the host again. (In this case you
should turn off host power anyway, as a safety measure, since otherwise all
output modules are held in last state.)