Return value: considerations, Example – Rockwell Automation 1747-PCIS API Software - Open Controller User Manual

Page 65

Advertising
background image

Publication 1747-UM002A-US-P - June 2000

Library of Routines 6-5

The scanner recognizes a match when every bit in the

IOIncludeMask

has finished transitioning. After a message is

generated, another message will be generated as soon as the next
specified number of matches occurs.

To disable DII’s, set

IOIncludeMask

to 0 with a valid

SlotNum

. DII’s

are disabled by default on reset.

Return Value:

Considerations:

Supported in the DOS API library and the Windows NT API library

Example:

HANDLE

Handle;

DII_CFG

diicfg;

int

retcode;

diicfg.Slotnum = 6;/* Slot 6 has discrete input module */

diicfg.IOIncludeMask = 1;/* bit 0 is the input trigger */

diicfg.IOEdgeType = 1;/* bit 0 must toggle from low to high */

diicfg.PresetCount = 3;/* bit 0 must toggle 3 times */

retcode = OC_ConfigureDII( Handle, &diicfg );

/* Use OC_PollScanner() to check for DII messages */

IOEdgeType

Defines the bit pattern to compare. Only bits that correspond to bits set to 1 in

IOIncludeMask

are used. Only bits 0 - 7 are valid.

IOEdgeType

is a

bit-mapped value. If a bit is set to 1, the comparison for the bit matches when
its corresponding discrete input bit changes from 0 to 1. If a bit is set to 0, the
comparison for the bit matches when its corresponding discrete input bit
changes from 1 to 0.

PresetCount

When

PresetCount

is 0 or 1, the scanner generates a message each time

the comparison matches. When it is between 2 and 65535, the message is
generated when the number of comparison matches meets

PresetCount

.

This value:

Means:

Name:

Value:

Description:

SUCCESS

0

discrete input interrupt (DII) was configured successfully

ERR_OCACCESS

2

handle

does not have access to the scanner

ERR_OCRESPONSE

10

scanner did not respond to request

ERR_OCSCANCFG

14

scanner has not been configured

ERR_OCSLOT

12

slot number is invalid

Advertising
This manual is related to the following products: