Rockwell Automation 6008-SV2R VMEbus remote I/O Scanner User Manual

Page 169

Advertising
background image

Chapter

Programming the Scanner

8

8Ć35

Programming Examples

/*
**
** READ_INPUT_WORD() –– read from selected input image table entry
**
**

This routine reads the specified entry in the discrete input table.

**
**

parameters:

pointer to channel structure

**

target rack number

**

target IO group word (0–7)

**

pointer to rack/IO group word value

**

return values:

none

**
*/

void
read_input_word (channel far *chan, int rack, int iogrp,

unsigned short far *rval)

{

unsigned short far *wordptr;
unsigned offset = ((rack * 8) + iogrp);

/* map channel & establish pointers */
map_channel(chan);
wordptr = (unsigned short far *) chan–>InputTable;
wordptr += offset;

/* read the word */
*rval = *wordptr;

/* unmap the channel */
unmap_channel(chan);
return;

}

Advertising
This manual is related to the following products: