beautypg.com

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

Page 80

background image

Chapter 7

Scanner Management

7-13

Example: Suppose you have two adapters connected, one controlling rack
1 (a full rack) and the other controlling the second half of rack 2. (The
adapter addresses are 4 x 1 + 0 / 2 = 4 and 4 x 2 + 4 / 2 = 10.) Suppose
you want to sample inputs from rack 2 every 5 seconds, but want the most
current information possible from rack 1. You would enter a scan list
request with adapter 2 occurring only once and adapter 1 occurring several
times.

At first glance, you might try a scan list of 64 bytes, with 63 repeats of
adapter 1 and one occurrence of adapter 2. (Since the scan list is processed
repetitively, it doesn’t matter where in the list the one occurrence of rack 2
is placed.) But if you want the most current information possible that may
not be a good idea.

Recall that it takes up to 11 ms at 57.6 Kbaud, or 7 ms at 115.2 Kbaud, to
scan each adapter in the scan list. If you’re operating at 115.2 Kbaud with
a scan list of 64 positions, your inputs are updated only every 64 x 7 = 448
ms. If you want information, say, every 100 ms, then you need a shorter
scan list. 100 / 7 = 14.3, so you want a scan list only 14 or 15 positions
long.

Here is code to create that scan list, using the memset function (provided
with many compilers) to initialize a block of memory:

QMR scan_list;

. . .

scan_list.qmr_len = 14; /* length of scan list */
/* 13 occurrences of first adapter */
memset(scan_list.qmr_data, 4, 13);
scan_list.qmr_data[13] = 10; /* second adapter */
mr_wait(C_SCANLIST, scan_list);
if ( scan_list.qmr_stat )

/* error code here */

Fault Dependant Group

In many applications, adapters are conceptually grouped together such that
if any one of the adapters in a group is faulted, you want all the others to
be faulted too. The fault dependent group (FDG) request implements this
concept.

FDGs are numbered from 0 to 7. When you issue a FDG request, you
specify which adapters should be put in FDGs and which FDGs they
should be put in.