Rockwell Automation 6008-SV2R VMEbus remote I/O Scanner User Manual
Page 172
![background image](/manuals/580456/172/background.png)
Chapter
Programming the Scanner
8
8Ć38
The programming example on page 8-15 shows how to program a
continuous block-transfer command in the scanner. The following
example shows how to update the block-transfer data.
Programming Example
/*
**
** CONFIGURE_CONTINUOUS_BT() –– configure a continuous block transfer read or write
**
** This function is driven by the data contained in the bt_data structured provided by
** the caller. The command word (CNBTW/CNBTR), BT address word, tag word, interrupt
** word, and BT transfer length word are placed in the Control/Status Area. The command
** is then asserted and its results returned to the caller.
**
** parameters: pointer to channel structure
** pointer to the bt_data structure
** return values: –1 = unable to lock general data area semaphore
** –2 = did not get cmd–complete interrupt
** ELSE channel confirmation status word
**
*/
int
configure_continuous_bt (channel far *chan, bt_data far *block)
{
csa_data far *csa;
unsigned short far *gda;
unsigned short res;
/* map channel & establish pointers */
map_channel(chan);
csa = (csa_data far *) chan–>ControlStatusArea;
gda = (unsigned short far *) chan–>GeneralDataArea;
/* get the semaphore */
if (lock_gda(chan) != 0) {
unmap_channel(chan);
fprintf(stdout, ”osbtread: lock aquire FAILED\n”);
return –1;
}
/* set up the control/status area */
csa–>cnfstat = 0x000F; /* confirmation status word */
csa–>cmd = block–>cmd; /* command word */
csa–>addr = block–>addr; /* address word */
csa–>tag = block–>tag; /* tag word */
csa–>irq = block–>irq; /* interrupt word */
csa–>datalen = block–>datalen; /* length of data word */