Oc_configuredii -5 – Rockwell Automation 1747-PCINT API Software for 1746 I/O User Manual

Page 59

Advertising
background image

OC_ConfigureDII

Library of Routines

6–5

Publication 1747-6.5.3 June 1998

OC_ConfigureDII

OC_ConfigureDII allows an application to receive a message from the scanner when
an input bit pattern of a discrete I/O module matches a compare value.

Syntax:

int

OC_ConfigureDII(HANDLE handle, DII_CFG *diicfg);

Parameters:

Description:

The application configures the compare value using this function and when the comparison completes, the
scanner generates a message to the application. The application must then call OC_PollScanner to retrieve
the message.

The

DII_CFG

structure is defined as:

typedef struct {

BYTE

SlotNum;

/* slot number 1-30*/

BYTE

IOIncludeMask;/* bits allowed mask */

BYTE

IOEdgeType;/* bit pattern to compare */

WORD

PresetCount;/* number of matches */

} DII_CFG;

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.

Parameter:

Description:

handle

Must be a valid handle returned from OC_OpenScanner

diicfg

Points to the DII configuration

This value:

Means:

Slotnum

Must contain the slot number of a Class 0 Discrete Input module. An I/O error report
is generated if the scanner determines the slot does not contain a valid discrete input
module.

IOIncludeMask

Should contain the bits in the discrete input module to include in the comparison.
Only bits 0 - 7 of word 0 of the module can be configured for DII’s.

IOIncludeMask

is a bit-mapped mask. Any bit set to 1 in this mask includes the corresponding bit of
the discrete input module in the comparison. Any bit set to 0 is ignored.

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

.

Advertising
This manual is related to the following products: