For information on the latest version, please have a look at GL013301.
flange_serial_open
This is a function for opening the flange serial transfer port in the robot controller.
This command is not available in the new flange version (v2).
Definition
DRFLEx.h within class CDRFLEx, public section (line 876)
bool flange_serial_open(
int nPort,
int baudrate = 115200,
BYTE_SIZE eByteSize = BYTE_SIZE_EIGHTBITS,
PARITY_CHECK eParity = PARITY_CHECK_NONE,
STOP_BITS eStopBits = STOPBITS_ONE)
{
return _flange_serial_open(_rbtCtrl, nPort, baudrate, eByteSize, eParity, eStopBits);
};
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
baudrate |
int |
115200 |
Baudrate setting for serial communication. |
nPort |
int |
Serial port index |
|
eByteSize |
BYTE_SIZE_EIGHTBITS |
Data bit length |
|
eParity |
PARITY_CHECK_NONE |
Parity configuration |
|
eStopBits |
STOPBITS_ONE |
Stop bit configuration |
Return
Value |
Description |
|---|---|
0 |
Error — failed to open serial port. |
1 |
Success — serial port successfully opened. |
Example
Drfl.flange_serial_open(115200, 0);
Drfl.flange_serial_write(0, "test123");
LPFLANGE_SER_BD_PARAM temp = Drfl.flange_serial_read(4, 5);
cout << "Serial read S = " << temp->_pSnd << endl;
cout << "Serial read R = " << (int)temp->_iSize << endl;
Drfl.flange_serial_close(0);
This example opens the flange serial port (channel 0) at 115200 baud, sends a test string, reads back a response buffer, and closes the serial connection.