This class represents a group of optically coupled input signals.
See class VIB::DigitalInput in the VisionBox Interface Library for a detailed description.
Public Member Functions | |
void | AbortWaitingForInputEvent () |
Aborts any thread that waits for an input event and disables further events. More... | |
void | ConfigureDebounceTime (UInt32 nsLow, UInt32 nsHigh) |
Sets debouncing time for the digital input signals. More... | |
void | ConfigureDebounceTime (UInt32 nsLow, UInt32 nsHigh, UInt32 enableMask) |
Sets debouncing time for the digital input signals. More... | |
void | ConfigureInputEvent (UInt32 SensitivityMaskRising, UInt32 SensitivityMaskFalling) |
Configures the sensitivity of the input events. More... | |
DigitalInput () | |
Default constructor for the device object More... | |
Boolean | GetBit (UInt32 BitIndex) |
Reads the state of the spicified digital input signal. More... | |
void | Reset () |
Resets the device to default settings. More... | |
UInt32 | WaitForInputEvent (UInt32 msTimeout) |
Waits for an input event More... | |
UInt32 | WaitForInputEvent (UInt32 msTimeout, UInt32 % EventSignals) |
Waits for an input event More... | |
Public Member Functions inherited from VIB_NET::iDevice | |
void | Close () |
Closes a device More... | |
bool | isOpen () |
Returns the open state of a device object More... | |
void | Open () |
Opens a device More... | |
void | Open (unsigned int Index) |
Opens a device More... | |
Properties | |
UInt32 | Input [get] |
Reads the state of the digital input signals. More... | |
UInt32 | NumberOfInputs [get] |
Returns the number of digital input signals. More... | |
UInt32 | SensitivityMask [set] |
Configures the sensitivity of the input events. More... | |
virtual VIB_NET::eDEVICE_TYPE | Type [get] |
Returns the device type for the current instance, see eDEVICE_TYPE More... | |
Properties inherited from VIB_NET::iDevice | |
virtual VIB_NET::eDEVICE_TYPE | Type [get] |
Returns the device type for the current instance, see eDEVICE_TYPE More... | |
VIB_NET::DigitalInput::DigitalInput | ( | ) |
Default constructor for the device object
The device must be opened with Open() before it can be used.
void VIB_NET::DigitalInput::AbortWaitingForInputEvent | ( | ) |
Aborts any thread that waits for an input event and disables further events.
The function will not return before any thread leaves the internal critical area. By using this function, the device can safely be closed after the call.
void VIB_NET::DigitalInput::ConfigureDebounceTime | ( | UInt32 | nsLow, |
UInt32 | nsHigh | ||
) |
Sets debouncing time for the digital input signals.
Digital input signals are filtered by a debounce function within the FPGA This affects the values returned by Input and GetBit(), the event function WaitForInputEvent(), and any use by other FPGA units like the Multiplexer.
The time values are specified for high and low state separately. A value of 0 deactivates the debouncing function. The FPGA uses a default setting of 200 ns after power-up.
The same debouncing setting is applied to all input signals.
nsLow | Time in nano-seconds the signal must stay low before it takes effect (falling edge), range 0...10000000 (10 ms) |
nsHigh | Time in nano-seconds the signal must stay high before it takes effect (rising edge), range 0...10000000 (10 ms) |
void VIB_NET::DigitalInput::ConfigureDebounceTime | ( | UInt32 | nsLow, |
UInt32 | nsHigh, | ||
UInt32 | enableMask | ||
) |
Sets debouncing time for the digital input signals.
Digital input signals are filtered by a debounce function within the FPGA This affects the values returned by Input and GetBit(), the event function WaitForInputEvent(), and any use by other FPGA units like the Multiplexer.
The time values are specified for high and low state separately. A value of 0 deactivates the debouncing function. The FPGA uses a default setting of 200 ns after power-up.
Debouncing can be enabled for specific inputs only by using the enableMask
argument.
nsLow | Time in nano-seconds the signal must stay low before it takes effect (falling edge), range 0...10000000 (10 ms) |
nsHigh | Time in nano-seconds the signal must stay high before it takes effect (rising edge), range 0...10000000 (10 ms) |
enableMask | Binary representation of signals with debouncing enabled |
void VIB_NET::DigitalInput::ConfigureInputEvent | ( | UInt32 | SensitivityMaskRising, |
UInt32 | SensitivityMaskFalling | ||
) |
Configures the sensitivity of the input events.
This function must be called before WaitForInputEvent().
The parameters specify which input lines will be used to generate events. The signal edge can be specified for each line individually.
SensitivityMaskRising | Binary representation of signals that trigger events on the rising edge |
SensitivityMaskFalling | Binary representation of signals that trigger events on the falling edge |
Boolean VIB_NET::DigitalInput::GetBit | ( | UInt32 | BitIndex | ) |
Reads the state of the spicified digital input signal.
BitIndex | Input bit, 0 ... (NumberOfInputs - 1) |
void VIB_NET::DigitalInput::Reset | ( | ) |
Resets the device to default settings.
See also VIB::DigitalInput::Reset().
UInt32 VIB_NET::DigitalInput::WaitForInputEvent | ( | UInt32 | msTimeout | ) |
Waits for an input event
The function waits for events on digital input lines which are selected with ConfigureInputEvent(). The function blocks until a new input event occurs, the timeout expires, or AbortWaitingForInputEvent() gets called.
msTimeout | Timeout in milli-seconds, 0xffffffff for infinite timeout The actual timeout may be twice as high if there are already other threads waiting for an event. |
UInt32
, containing the current value of the digital inputs and the changed signals:UInt32 VIB_NET::DigitalInput::WaitForInputEvent | ( | UInt32 | msTimeout, |
UInt32 % | EventSignals | ||
) |
Waits for an input event
See overloaded version of WaitForInputEvent() for a detailed description.
msTimeout | Timeout in milli-seconds, 0xffffffff for infinite timeout The actual timeout may be twice as high if there are already other threads waiting for an event. |
EventSignals | After success, the function returns the input signals which triggered the event (binary representation). |
|
get |
Reads the state of the digital input signals.
The returned value is the binary representation of the input signals, LSB is input 0
|
get |
Returns the number of digital input signals.
|
set |
Configures the sensitivity of the input events.
The parameter SensitivityMask
specifies which inputs will be used to generate events.
For every input can be configured individually, which edge will be generate an event. There a four options available, none, rising, falling and both.
SensitivityMask | Per bit/input there are two configuration modes available. If bit 0 ... 15 are set, the corresponding input will trigger on both edges If bit 16 ... 31 are set, the lower bits 0 ... 15 configure the edge, 1 <> rising, 0<> falling |
C#: DigInOut_Example.cs
Visual Basic: DigInOut_Example.vb
|
get |
Returns the device type for the current instance, see eDEVICE_TYPE