Overview
Functions for reading and writing the analog and digital inputs and outputs of Nemesys devices.
Functions | |
long | NemV4ReadAnalogInput (TNemesysV4 *Nemesys, enum eNemV4AnalogInput Input, int16_t *Value_mV) |
Reads the analog input value of the given Input and returns it in Value_mV. More... | |
long | NemV4ReadDigitalInput (TNemesysV4 *Nemesys, enum eNemV4DigitalInput Input) |
Reads the state of one single digital input. More... | |
long | NemV4ReadDigitalInputs (TNemesysV4 *Nemesys, uint32_t *Inputs) |
Reads all 4 digital inputs from the device and returns the inputs bitmask in Inputs. More... | |
long | NemV4SwitchValve (TNemesysV4 *Nemesys, uint8_t ValvePosition) |
Switches a valve connected to the Nemesys I/O connector to a given position. More... | |
long | NemV4WriteDigitalOutput (TNemesysV4 *Nemesys, enum eNemV4DigitalOutput Output, uint8_t On) |
Switches one single digital output channel on/off. More... | |
long | NemV4WriteDigitalOutputs (TNemesysV4 *Nemesys, uint32_t OutputMask, uint32_t States) |
Switches the given digital outputs on/off. More... | |
Function Documentation
long NemV4ReadAnalogInput | ( | TNemesysV4 * | Nemesys, |
enum eNemV4AnalogInput | Input, | ||
int16_t * | Value_mV | ||
) |
Reads the analog input value of the given Input and returns it in Value_mV.
- Parameters
-
[in] Nemesys Device pointer [in] Input Input identifier. Nemesys pumps have two analog input: the external analog input from the I/O interface and the internal force sensor analog input. [out] Value_mV Returns the value read from Nemesys in mV
- Returns
- Error code - ERR_NOERR indicates success
Referenced by NemV4ReadForceSensor().
long NemV4ReadDigitalInput | ( | TNemesysV4 * | Nemesys, |
enum eNemV4DigitalInput | Input | ||
) |
Reads the state of one single digital input.
This is just a convenience function that calls NemV4ReadDigitalInputs internally.
- Parameters
-
Nemesys The Nemesys device to read from. Input The input identifiers.
- Return values
-
< 0 Error 0 Input is off 1 Input is on
Referenced by NemV4IsSafetyStopActive().
long NemV4ReadDigitalInputs | ( | TNemesysV4 * | Nemesys, |
uint32_t * | Inputs | ||
) |
Reads all 4 digital inputs from the device and returns the inputs bitmask in Inputs.
Inputs contains the input bitmask for all 4 digital inputs. To test for a certain digital input use the eDigitalInput enum values. The following example shows, how to test if the safety stop input is active.
- Parameters
-
Nemesys The device to read from Inputs Input bit mask. Use the eNemV4DigitalInput enum values to test for a certain input.
- Returns
- Error code - ERR_NOERR indicates success
Referenced by NemV4ReadDigitalInput().
long NemV4SwitchValve | ( | TNemesysV4 * | Nemesys, |
uint8_t | ValvePosition | ||
) |
Switches a valve connected to the Nemesys I/O connector to a given position.
The two digital outputs NEM4_DIG_OUT_EXTERNAL_1 and NEM4_DIG_OUT_EXTERNAL_2 are used for valve switching. With these two output it is possible to switch 4 different valve positions (Binary: 00, 01, 10, 11). For different valves, different switching positions are available:
- 3/2 way CETONI smartvalve: you can switch the two positions 0 and 1 (application, reservoir)
- 3/4 way CETONI smartvalve: you can switch the positions 0 - closed, 1 - Port 1, 2 - Port 2 and 3 - both ports open. You can also use the enumeration eNemV4ContiflowValvePositions for switching
- 4/4 way ball valve: you can switch the positions 0 - closed, 1 - Port 1, 2 - Port 2. You can also use the enumeration eNemV4ContiflowValvePositions for switching
- Parameters
-
Nemesys The Nemesys device to control ValvePosition Valve position in the range from 0 - 3
- Returns
- Error code - ERR_NOERR indicates success
long NemV4WriteDigitalOutput | ( | TNemesysV4 * | Nemesys, |
enum eNemV4DigitalOutput | Output, | ||
uint8_t | On | ||
) |
Switches one single digital output channel on/off.
If you would like to switch multiple digital outputs at the same time, you should use the NemV4WriteDigitalOutputs() function.
- Parameters
-
Nemesys The device to control Output The digital output channel (see eNemV4DigitalOutput) On 0 = off, 1 = on
- Returns
- Error code - ERR_NOERR indicates success
- See also
- NemV4WriteDigitalOutputs()
long NemV4WriteDigitalOutputs | ( | TNemesysV4 * | Nemesys, |
uint32_t | OutputMask, | ||
uint32_t | States | ||
) |
Switches the given digital outputs on/off.
This functions switches multiple digital outputs at the same time. The OutputMask parameter defines, which outputs to set and the States parameter configures the on/off state of the outputs that will be switched. Use the enum eNemV4DigitalOutput to create the OutputMask and the output states parameter. If you would like to switch only a single digital output, it is easier to use the NemV4WriteDigitalOutput() function.
The following code switches the blue device LED on and off.
The following code switches the I/O interface digital outputs 1 on and the digital output 2 off.
- Parameters
-
Nemesys The device to control OutputMask Digital output mask configures the digital outputs to switch States The states (0 = off, 1 = on) of the digital outputs to switch
- Returns
- Error code - ERR_NOERR indicates success
- See also
- NemV4WriteDigitalOutput()
Referenced by NemV4SwitchValve(), and NemV4WriteDigitalOutput().