06.01.2015 Views

INfinity 510 Protocol Reference Guide - Sirit

INfinity 510 Protocol Reference Guide - Sirit

INfinity 510 Protocol Reference Guide - Sirit

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 4 - Reader Behavior<br />

In the following example, the state of the outputs is read and then all four<br />

outputs are changed (i.e. those that were on are switched off and vice<br />

versa):<br />

> dio.out.all<br />

ok 0xA<br />

> dio.out.all=0x5<br />

ok<br />

Asynchronous notification of DIO changes<br />

Whenever the state of digital inputs or digital outputs change, certain<br />

events are generated. Depending on the specific needs of your application,<br />

you may choose to register for some or all of these events.<br />

event.dio.in.X value=Y – This event indicates that digital input<br />

X has changed, and its new value is Y. X will be from 1 to 4, and Y will<br />

be either 0 or 1.<br />

event.dio.out.X value=Y – This event indicates that digital<br />

output X has changed, and its new value is Y. X will be from 1 to 4, and<br />

Y will be either 0 or 1.<br />

event.dio.all in=X, out=Y – This event is sent whenever any<br />

digital inputs or outputs change. It provides, in hexadecimal format, the<br />

state of all digital inputs (X) and all digital outputs (Y). The format of X<br />

and Y are the same as the format of the dio.in.all and<br />

dio.out.all variables.<br />

For example, if all four digital inputs are high, and then digital input 3 goes<br />

low, the following two events are generated. In this case, digital outputs 2<br />

and 4 are enabled (connected to ground):<br />

event.dio.in.3 value=0<br />

event.dio.all in=0x0b, out=0x05<br />

Debouncing<br />

Depending on the nature of the device connected to the digital inputs, some<br />

debouncing may be necessary. The variable dio.debounce.X sets a<br />

specific debounce time for each digital input. Input changes will only be<br />

reported after the new value has been asserted for greater than the amount<br />

of time specified by the debounce variable.<br />

If very fast pulsed inputs are used, ensure the debounce time is not too low<br />

(less than the pulse width), or an input pulse may be missed. If a noisy<br />

switch contact is used as an input, ensure the debounce time is high<br />

enough to account for the noise on the contact.<br />

<strong>INfinity</strong> <strong>510</strong> <strong>Protocol</strong> <strong>Reference</strong> <strong>Guide</strong> 23

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!