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... | |
iDevice & | operator= (const iDevice &device) |
The assignment operator makes a copy of the existing device object More... | |
virtual | ~iDevice () |
Deletes the device object More... | |
Source definitions for the RS-422 output signals, used by SetSource()
VIB::Rs422::Rs422 | ( | ) |
Default constructor for the device object
The device must be opened with Open() before it can be used.
bool VIB::Rs422::Get | ( | unsigned int & | InputState | ) |
Returns the state of the input signals.
InputState | Binary representation of input signals, the LSB contains the state of the first signal |
true
for success, use VIBSystem::GetLastErrorString() for an error descriptionbool VIB::Rs422::GetBit | ( | unsigned int | signalIndex, |
bool & | state | ||
) |
Returns the state of one input signal.
signalIndex | Input signal index, 0 ... (GetNumberOfInputs() - 1) |
state | Current state of the signal |
true
for success, use VIBSystem::GetLastErrorString() for an error descriptionbool VIB::Rs422::GetNumberOfInputs | ( | unsigned int & | NumberOfInputs | ) |
Returns the number of input signals.
NumberOfInputs | Number of input signals |
true
for success, use VIBSystem::GetLastErrorString() for an error descriptionbool VIB::Rs422::GetNumberOfOutputs | ( | unsigned int & | NumberOfOutputs | ) |
Returns number of output signals.
NumberOfOutputs | Number of output signals |
true
for success, use VIBSystem::GetLastErrorString() for an error descriptionbool VIB::Rs422::Reset | ( | ) |
Resets the device to default settings.
All outputs are turned off.
true
for success, use VIBSystem::GetLastErrorString() for an error descriptionbool VIB::Rs422::Set | ( | unsigned int | value | ) |
Sets the state of the output signals.
value | Bits 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. |
true
for success, use VIBSystem::GetLastErrorString() for an error descriptionbool VIB::Rs422::SetBit | ( | unsigned int | signalIndex, |
bool | state | ||
) |
Sets the state of one output signal.
signalIndex | Output signal index, 0 ... (GetNumberOfOutputs() - 1) |
state | Signal state |
true
for success, use VIBSystem::GetLastErrorString() for an error descriptionbool 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).
signalIndex | Output signal index, 0 ... (GetNumberOfOutputs() - 1) |
Source | Source for the signal |
InvertOutput | Polarity of the signal |
true
for success, use VIBSystem::GetLastErrorString() for an error description