set_mode_analog_output
This function sets the output channel mode for an analog output port
mounted on the robot controller’s control box.
Each analog output channel can be configured to output either
a current (mA) or voltage (V) signal depending on the external device requirements.
Definition
DRFLEx.h within class CDRFLEx, public section (line 851)
bool set_mode_analog_output(GPIO_CTRLBOX_ANALOG_INDEX eGpioIndex,
GPIO_ANALOG_TYPE eAnalogType = GPIO_ANALOG_TYPE_CURRENT)
{ return _set_mode_analog_output(_rbtCtrl, eGpioIndex, eAnalogType); };
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
eGpioIndex |
Index of the analog output port on the control box. |
||
eAnalogType |
GPIO_ANALOG_TYPE_CURRENT |
Type of analog output mode. |
Return
Value |
Description |
|---|---|
0 |
Error — failed to configure the analog output mode |
1 |
Success — mode configuration applied successfully |
Example
#include "DRFLEx.h"
using namespace DRAFramework;
int main() {
CDRFLEx drfl;
// Set analog output #1 to current mode (4–20 mA)
drfl.set_mode_analog_output(GPIO_CTRLBOX_ANALOG_INDEX_1, GPIO_ANALOG_TYPE_CURRENT);
// Set analog output #2 to voltage mode (0–10 V)
drfl.set_mode_analog_output(GPIO_CTRLBOX_ANALOG_INDEX_2, GPIO_ANALOG_TYPE_VOLTAGE);
}
This example configures analog output #1 to operate in current mode and analog output #2 in voltage mode, enabling the robot controller to generate output signals compatible with various external control devices.