Rockwell Automation 6008-SV2R VMEbus remote I/O Scanner User Manual
Page 170
Chapter
Programming the Scanner
8
8Ć36
/*
**
** WRITE_OUTPUT_WORD() –– write to selected output image table entry
**
**
This routine writes the specified entry in the discrete output table with the
**
given value.
**
**
parameters:
pointer to channel structure
**
target rack number
**
target IO group word (0–7)
**
word value to write
**
return values:
none
**
*/
void
write_output_word (channel far *chan, int rack, int iogrp, unsigned short wval)
{
unsigned short far *wordptr;
unsigned offset = ((rack * 8) + iogrp);
/* map the channel & establish pointers */
map_channel(chan);
wordptr = (unsigned short far *) chan–>OutputTable;
wordptr += offset;
/* write the word */
*wordptr = wval;
/* unmap the channel */
unmap_channel(chan);
return;
}
/*
**
** ONESHOT_BT_COMPLETE() –– process a completed one–shot block transfer
**
**
This function should be called when it is known that a one–shot block transfer has
**
completed. (This is typically signalled via a VME interrupt.) The routine will
**
access the channel’s Control/Status Area and General Data Area, placing the result
**
data in the bt_data structure passed by the caller. If the completed operation
**
is a BT read, the routine will place the read data in the bt_data parameter’s data
**
buffer field.
**
**
parameters:
pointer to channel structure
**
pointer to the bt_data structure
**
return values:
–1
= General Data Area semaphore not locked
**
ELSE
channel confirmation status word
**
*/
int
oneshot_bt_complete (channel far *chan, bt_data far *block)
{
csa_data far
*csa;
unsigned short far
*gda;
unsigned short
i;