VisionBox Interface Library  1.7.9.0 (2023-09-08)
VIB::DigitalOutput Class Reference
+ Inheritance diagram for VIB::DigitalOutput:

Detailed Description

This class controls a group of digital output signals.

Features

  • Set output signals by software using Set() and SetBit()
  • VisionBox / VisionCam:
    Control outputs by other RTCC units by using Multiplexer as the source signal, see SetSource().
  • VisionSensor:
    Use exposure of the image sensor for an output signal, controlled by the FG Camera libraray: FG_set_special_option("StrobeMode", ...)

For a detailed electrical specification, please take a look at the Hardware Manual for the specific device.

+Example code
// open the first DigitalOutput device:
digOutput.Open(0);
// turn all outputs on (up to 16)
digOutput.Set(0xffff);
// turn output signals off one after another
unsigned int outputSignals;
digOutput.GetNumberOfOutputs(outputSignals);
for (unsigned int signal = 0; signal < outputSignals; signal++)
{
digOutput.SetBit(signal, false);
}
// connect the Multiplexer line 1 to digital OUT3 (not valid for the VisionSensor):
Please note that error checking was removed to keep the code as simple as possible.

Public Types

enum  OUT_SOURCE
 Sources for the digital outputs, used with SetSource() More...
 

Public Member Functions

 DigitalOutput ()
 Default constructor for the device object More...
 
bool GetNumberOfOutputs (unsigned int &NumberOfOutputs)
 Returns number of output channels. More...
 
bool Reset ()
 Resets the device to default settings. More...
 
bool Set (unsigned int Val)
 Sets the state of the digital output signals. More...
 
bool SetBit (unsigned int BitIndex, bool OnOff)
 Sets the state of the specified digital output. More...
 
bool SetSource (unsigned int BitIndex, OUT_SOURCE Source, bool InvertOutput)
 Sets the source for the specified output signal. More...
 
- Public Member Functions inherited from VIB::iDevice
bool Close ()
 Closes a device More...
 
 iDevice (const iDevice &device)
 The copy constructor makes a copy of the existing device object More...
 
bool isOpen (bool &state)
 Returns the open state of a device object More...
 
bool Open (unsigned int Index=0)
 Opens a device More...
 
iDeviceoperator= (const iDevice &device)
 The assignment operator makes a copy of the existing device object More...
 
virtual ~iDevice ()
 Deletes the device object More...
 

Member Enumeration Documentation

◆ OUT_SOURCE

Sources for the digital outputs, used with SetSource()

Enumerator
DIG_OUT_SRC_REGISTER 

Output is controlled Set() and SetBit() (default)

DIG_OUT_SRC_MUX_OUT0 

Multiplexer Output 0.

DIG_OUT_SRC_MUX_OUT1 

Multiplexer Output 1.

DIG_OUT_SRC_MUX_OUT2 

Multiplexer Output 2.

DIG_OUT_SRC_MUX_OUT3 

Multiplexer Output 3.

DIG_OUT_SRC_MUX_OUT4 

Multiplexer Output 4.

DIG_OUT_SRC_MUX_OUT5 

Multiplexer Output 5.

DIG_OUT_SRC_MUX_OUT6 

Multiplexer Output 6

DIG_OUT_SRC_MUX_OUT7 

Multiplexer Output 7.

DIG_OUT_SRC_MUX_OUT8 

Multiplexer Output 8.

DIG_OUT_SRC_MUX_OUT9 

Multiplexer Output 9.

DIG_OUT_SRC_MUX_OUT10 

Multiplexer Output 10.

DIG_OUT_SRC_MUX_OUT11 

Multiplexer Output 11.

DIG_OUT_SRC_MUX_OUT12 

Multiplexer Output 12.

DIG_OUT_SRC_MUX_OUT13 

Multiplexer Output 13.

DIG_OUT_SRC_MUX_OUT14 

Multiplexer Output 14.

DIG_OUT_SRC_MUX_OUT15 

Multiplexer Output 15.

DIG_OUT_SRC_MUX_OUT16 

Multiplexer Output 16.

DIG_OUT_SRC_MUX_OUT17 

Multiplexer Output 17.

DIG_OUT_SRC_MUX_OUT18 

Multiplexer Output 18.

DIG_OUT_SRC_MUX_OUT19 

Multiplexer Output 19.

DIG_OUT_SRC_MUX_OUT20 

Multiplexer Output 20.

DIG_OUT_SRC_MUX_OUT21 

Multiplexer Output 21.

DIG_OUT_SRC_MUX_OUT22 

Multiplexer Output 22.

DIG_OUT_SRC_MUX_OUT23 

Multiplexer Output 23.

Constructor & Destructor Documentation

◆ DigitalOutput()

VIB::DigitalOutput::DigitalOutput ( )

Default constructor for the device object

The device must be opened with Open() before it can be used.

Member Function Documentation

◆ GetNumberOfOutputs()

bool VIB::DigitalOutput::GetNumberOfOutputs ( unsigned int &  NumberOfOutputs)

Returns number of output channels.

Parameters
NumberOfOutputsNumber of output channels
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ Reset()

bool VIB::DigitalOutput::Reset ( )

Resets the device to default settings.

All outputs are turned off.

Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ Set()

bool VIB::DigitalOutput::Set ( unsigned int  Val)

Sets the state of the digital output signals.

The actual number of available outputs is hardware dependent, see GetNumberOfOutputs().

Parameters
Val
  • Bits 0...15: Binary representation of digital outputs.
  • Bits 16...31: Mask bits: only signals for which the mask bit is set will be changed, all other signals are ignored. Exception: if the upper 16 bits of Val are zero, then all outputs will be set.
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description
Example:
digOutput.Open();
// set output 0 and 1 to on, all other to off:
digOutput.Set(0x3);
// set output 3 to on, leave others untouched
digOutput.Set((1<<(16+3)) | (1<<3));

◆ SetBit()

bool VIB::DigitalOutput::SetBit ( unsigned int  BitIndex,
bool  OnOff 
)

Sets the state of the specified digital output.

Parameters
BitIndexOutput index, 0 ... (GetNumberOfOutputs() - 1)
OnOffOutput value
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ SetSource()

bool VIB::DigitalOutput::SetSource ( unsigned int  BitIndex,
DigitalOutput::OUT_SOURCE  Source,
bool  InvertOutput 
)

Sets the source for the specified output signal.

The power-up value DIG_OUT_SRC_REGISTER is used for manual control by using Set() and SetBit().

Parameters
BitIndexOutput index, 0 ... (GetNumberOfOutputs() - 1)
SourceSource for the output
InvertOutputPolarity inversion
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description
Precondition
  • This function is not available for the VisionBox AGE-X1 and the VisionSensor PV
  • Requires FPGA version ≥ 1.0.0.20
VIB::DigitalOutput::DIG_OUT_SRC_MUX_OUT1
@ DIG_OUT_SRC_MUX_OUT1
Multiplexer Output 1.
Definition: VIB_Interface.h:472
VIB::DigitalOutput::Set
bool Set(unsigned int Val)
Sets the state of the digital output signals.
Definition: DigitalOutput.cpp:122
VIB::DigitalOutput::SetSource
bool SetSource(unsigned int BitIndex, OUT_SOURCE Source, bool InvertOutput)
Sets the source for the specified output signal.
Definition: DigitalOutput.cpp:154
VIB::DigitalOutput::GetNumberOfOutputs
bool GetNumberOfOutputs(unsigned int &NumberOfOutputs)
Returns number of output channels.
Definition: DigitalOutput.cpp:93
VIB::DigitalOutput
This class controls a group of digital output signals.
Definition: VIB_Interface.h:464
VIB::DigitalOutput::SetBit
bool SetBit(unsigned int BitIndex, bool OnOff)
Sets the state of the specified digital output.
Definition: DigitalOutput.cpp:135
VIB::iDevice::Open
bool Open(unsigned int Index=0)
Opens a device
Definition: iDevice.cpp:109