VisionBox Interface Library  1.7.5.0 (2021-12-10)
VIB::Rs422 Class Reference
+ Inheritance diagram for VIB::Rs422:

Detailed Description

This class controls the RS-422 interface.

This class represents a group of differential I/O signals. For a detailed electrical specification please look into the hardware manual.

At this layer, the interface is represented as generic signals. There is no protocol implemented like the COM/RS232 interface.

Other units can use the RS-422 input signals directly without this class. For example, the IOScheduler can use them as encoder input.

Public Types

enum  OUT_SOURCE
 Source definitions for the RS-422 output signals, used by SetSource() More...
 

Public Member Functions

bool Get (unsigned int &InputState)
 Returns the state of the input signals. More...
 
bool GetBit (unsigned int BitIndex, bool &BitState)
 Returns the state of one input signal. More...
 
bool GetNumberOfInputs (unsigned int &NumberOfInputs)
 Returns the number of input signals. More...
 
bool GetNumberOfOutputs (unsigned int &NumberOfOutputs)
 Returns number of output signals. More...
 
bool Reset ()
 Resets the device to default settings. More...
 
 Rs422 ()
 Default constructor for the device object More...
 
bool Set (unsigned int Val)
 Sets the state of the output signals. More...
 
bool SetBit (unsigned int BitIndex, bool Val)
 Sets the state of one output signal. More...
 
bool SetSource (unsigned int BitIndex, OUT_SOURCE Source, bool InvertOutput)
 Sets the source for an 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

Source definitions for the RS-422 output signals, used by SetSource()

Enumerator
RS422_SRC_REGISTER 

Controlled by Set() / SetBit() (default)

RS422_SRC_MUX_OUT0 

Multiplexer Output 0.

RS422_SRC_MUX_OUT1 

Multiplexer Output 1.

RS422_SRC_MUX_OUT2 

Multiplexer Output 2.

RS422_SRC_MUX_OUT3 

Multiplexer Output 3.

RS422_SRC_MUX_OUT4 

Multiplexer Output 4.

RS422_SRC_MUX_OUT5 

Multiplexer Output 5.

RS422_SRC_MUX_OUT6 

Multiplexer Output 6

RS422_SRC_MUX_OUT7 

Multiplexer Output 7.

RS422_SRC_MUX_OUT8 

Multiplexer Output 8.

RS422_SRC_MUX_OUT9 

Multiplexer Output 9.

RS422_SRC_MUX_OUT10 

Multiplexer Output 10.

RS422_SRC_MUX_OUT11 

Multiplexer Output 11.

RS422_SRC_MUX_OUT12 

Multiplexer Output 12.

RS422_SRC_MUX_OUT13 

Multiplexer Output 13.

RS422_SRC_MUX_OUT14 

Multiplexer Output 14.

RS422_SRC_MUX_OUT15 

Multiplexer Output 15.

RS422_SRC_MUX_OUT16 

Multiplexer Output 16.

RS422_SRC_MUX_OUT17 

Multiplexer Output 17.

RS422_SRC_MUX_OUT18 

Multiplexer Output 18.

RS422_SRC_MUX_OUT19 

Multiplexer Output 19.

RS422_SRC_MUX_OUT20 

Multiplexer Output 20.

RS422_SRC_MUX_OUT21 

Multiplexer Output 21.

RS422_SRC_MUX_OUT22 

Multiplexer Output 22.

RS422_SRC_MUX_OUT23 

Multiplexer Output 23.

Constructor & Destructor Documentation

◆ Rs422()

VIB::Rs422::Rs422 ( )

Default constructor for the device object

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

Member Function Documentation

◆ Get()

bool VIB::Rs422::Get ( unsigned int &  InputState)

Returns the state of the input signals.

Parameters
InputStateBinary representation of input signals, the LSB contains the state of the first signal
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ GetBit()

bool VIB::Rs422::GetBit ( unsigned int  signalIndex,
bool &  state 
)

Returns the state of one input signal.

Parameters
signalIndexInput signal index, 0 ... (GetNumberOfInputs() - 1)
stateCurrent state of the signal
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ GetNumberOfInputs()

bool VIB::Rs422::GetNumberOfInputs ( unsigned int &  NumberOfInputs)

Returns the number of input signals.

Parameters
NumberOfInputsNumber of input signals
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ GetNumberOfOutputs()

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

Returns number of output signals.

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

◆ Reset()

bool VIB::Rs422::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::Rs422::Set ( unsigned int  value)

Sets the state of the output signals.

Parameters
valueBits 0..15: Binary representation of outputs. The actual number of available outputs is hardware dependent.
Bits 16..31: Mask bits can be used to change only certain outputs. This is particularly useful to control certain outputs by different threads.
If the upper 16 bits of value are set to zero, all outputs will be set.
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description
Example:
//change BIT0 & BIT1 to on, all other to off
if ( !pRS422->Set(0x3) )
goto error;
//turn BIT1 off, BIT0 stays on
if ( !pRS422->Set( (1<<(16+1)) | 0x00) )
goto error;

◆ SetBit()

bool VIB::Rs422::SetBit ( unsigned int  signalIndex,
bool  state 
)

Sets the state of one output signal.

Parameters
signalIndexOutput signal index, 0 ... (GetNumberOfOutputs() - 1)
stateSignal state
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ SetSource()

bool VIB::Rs422::SetSource ( unsigned int  signalIndex,
Rs422::OUT_SOURCE  Source,
bool  InvertOutput 
)

Sets the source for an output signal.

For setting the output value manually with Set() or SetBit(), the source RS422_SRC_REGISTER has to be selected (default).

Note
If the RS-422 interface is provided by Camera Link hardware, it only supports the first 16 Multiplexer lines as source signal.
The VisionBox AGE-X1 doesn't have a Multiplexer and therefore doesn't support this function
Parameters
signalIndexOutput signal index, 0 ... (GetNumberOfOutputs() - 1)
SourceSource for the signal
InvertOutputPolarity of the signal
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description