5. Robot IO
5.1. Setting the control box digital outputs
1/**
2* @brief Setting up the control box digital outputs.
3* @param [in] id io number, range [0~15]
4* @param [in] status 0-off, 1-on
5* @param [in] smooth 0-not smooth, 1-smooth
6* @param [in] block 0-Blocking, 1-Non-blocking
7* @return Error code
8*/
9int SetDO(int id, byte status, byte smooth, byte block);
5.2. Set the tool digital output
1/**
2* @brief Setting the tool digital output
3* @param [in] id io number, range [0~1]
4* @param [in] status 0-off, 1-on
5* @param [in] smooth 0-not smooth, 1-smooth
6* @param [in] block 0-Blocking, 1-Non-blocking
7* @return Error code
8*/
9int SetToolDO(int id, byte status, byte smooth, byte block);
5.3. Set the control box analog output
1/**
2* @brief Setting up the control box analog outputs.
3* @param [in] id io number, range [0~1].
4* @param [in] value Percentage of current or voltage value, range [0~100] Corresponding to current value [0~20mA] or voltage [0~10V].
5* @param [in] block 0-blocking, 1-non-blocking
6* @return Error code
7*/
8int SetAO(int id, float value, byte block).
5.4. Set the tool analog output
1/**
2* @brief set tool analog output
3* @param [in] id io number, range [0].
4* @param [in] value Percentage of current or voltage value, range [0~100] corresponding to current value [0~20mA] or voltage [0~10V]
5* @param [in] block 0-blocking, 1-non-blocking
6* @return Error code
7*/
8int SetToolAO(int id, float value, byte block).
5.5. Set digital, analog output code example
1private void button14_Click(object sender, EventArgs e)
2{
3 byte status = 1;
4 byte smooth = 0;
5 byte block = 0;
6 byte di = 0, tool_di = 0;
7 float ai = 0.0f, tool_ai = 0.0f;
8 float value = 0.0f;
9
10
11 for (int i = 0; i < 16; i++)
12 {
13 robot.SetDO(i, status, smooth, block);
14 Thread.Sleep(300);
15 }
16
17 status = 0;
18
19 for (int i = 0; i < 16; i++)
20 {
21 robot.SetDO(i, status, smooth, block);
22 Thread.Sleep(300);
23 }
24
25 status = 1;
26
27 for (int i = 0; i < 2; i++)
28 {
29 robot.SetToolDO(i, status, smooth, block);
30 Thread.Sleep(1000);
31 }
32
33 status = 0;
34
35 for (int i = 0; i < 2; i++)
36 {
37 robot.SetToolDO(i, status, smooth, block);
38 Thread.Sleep(1000);
39 }
40
41 for (int i = 0; i < 100; i++)
42 {
43 robot.SetAO(0, i, block);
44 Thread.Sleep(30);
45 }
46
47 for (int i = 0; i < 100; i++)
48 {
49 robot.SetToolAO(0, i, block);
50 Thread.Sleep(30);
51 }
52
53}
5.6. etting control box digital inputs
1/**
2* @brief Get control box digital inputs.
3* @param [in] id io number, range [0~15]
4* @param [in] block 0-blocking, 1-non-blocking
5* @param [out] result 0-low level, 1-high level
6* @return error code
7*/
8int GetDI(int id, byte block, ref byte level).
5.7. Get tool digital input
1/**
2* @brief Get instrumented digital input
3* @param [in] id io number, range [0~1]
4* @param [in] block 0-blocking, 1-non-blocking
5* @param [out] result 0-low level, 1-high level
6* @return error code
7*/
8int GetToolDI(int id, byte block, ref byte level);
5.8. Get control box analog input
1/**
2* @brief Get control box analog inputs.
3* @param [in] id io number, range [0~1]
4* @param [in] block 0-blocking, 1-non-blocking
5* @param [out] result Input current or voltage value percentage, range [0~100] corresponding to current value [0~20mS] or voltage [0~10V]
6* @return error code
7*/
8int GetAI(int id, byte block, ref float persent).
5.9. Get tool analog input
1/**
2* @brief Get tool analog input
3* @param [in] id io number, range [0]
4* @param [in] block 0-blocking, 1-non-blocking
5* @param [out] result Input current or voltage value percentage, range [0~100] corresponds to current value [0~20mS] or voltage [0~10V]
6* @return error code
7*/
8int GetToolAI(int id, byte block, ref float persent).
5.11. Get the robot end DO output state
1/**
2* @brief Get robot end DO output state.
3* @param [out] do_state DO output state, do0~do1 corresponds to bit1~bit2, start from bit0.
4* @return Error code
5*/
6int GetToolDO(ref byte do_state).
5.12. Get the DO output state of the machine controller
1/**
2* @brief Get robot controller DO output state.
3* @param [out] do_state_h DO output state, co0~co7 corresponds to bit0~bit7
4* @param [out] do_state_l DO output state, do0~do7 corresponds to bit0~bit7
5* @return Error code
6*/
7int GetDO(ref int do_state_h, ref int do_state_l);
5.13. Get robot DI, DO state code example
1private void button15_Click(object sender, EventArgs e)
2{
3 byte status = 1;
4 byte smooth = 0;
5 byte block = 0;
6 byte di = 0, tool_di = 0;
7 float ai = 0.0f, tool_ai = 0.0f;
8 float value = 0.0f;
9
10 robot.GetDI(0, block, ref di);
11 Console.WriteLine($"di0: {di}");
12
13 tool_di = (byte)robot.GetToolDI(1, block, ref tool_di);
14 Console.WriteLine($"tool_di1: {tool_di}");
15
16 robot.GetAI(0, block, ref ai);
17 Console.WriteLine($"ai0: {ai}");
18
19 tool_ai = robot.GetToolAI(0, block, ref tool_ai);
20 Console.WriteLine($"tool_ai0: {tool_ai}");
21
22 byte _button_state = 0;
23 robot.GetAxlePointRecordBtnState(ref _button_state);
24 Console.WriteLine($"_button_state is: {_button_state}");
25
26 byte tool_do_state = 0;
27 robot.GetToolDO(ref tool_do_state);
28 Console.WriteLine($"tool DO state is: {tool_do_state}");
29
30 int do_state_h = 0;
31 int do_state_l = 0;
32 robot.GetDO(ref do_state_h, ref do_state_l);
33 Console.WriteLine($"DO state high is: {do_state_h}\n DO state low is: {do_state_l}");
34}
5.14. Wait for control box digital input
1/**
2* @brief Wait for control box digital input.
3* @param [in] id io number, range [0~15]
4* @param [in] status 0-off, 1-on
5* @param [in] max_time Maximum waiting time in ms
6* @param [in] opt Timeout policy, 0-program stops and prompts for timeout, 1-ignore timeout prompts and continue execution, 2-wait all the time.
7* @return error_code
8*/
9int WaitDI(int id, byte status, int max_time, int opt).
5.15. Wait for multiple digital inputs to the control box
1/**
2* @brief Waiting for control box multiplexed digital inputs.
3* @param [in] mode 0-multiplex with, 1-multiplex or
4* @param [in] id io number, bit0~bit7 corresponds to DI0~DI7, bit8~bit15 corresponds to CI0~CI7
5* @param [in] status 0-off, 1-on
6* @param [in] max_time Maximum wait time in ms.
7* @param [in] opt Timeout policy, 0 - program stops and prompts for timeout, 1 - ignores timeout prompts and continues execution, 2 - waits forever.
8* @return error_code
9*/
10int WaitMultiDI(int mode, int id, byte status, int max_time, int opt).
5.16. Wait for tool digital input
1/**
2* @brief Waiting for instrumented digital input
3* @param [in] id io number, range [0~1]
4* @param [in] status 0-off, 1-on
5* @param [in] max_time Maximum wait time in ms
6* @param [in] opt Timeout policy, 0-program stops and prompts for timeout, 1-ignore timeout prompts and continue execution, 2-wait all the time.
7* @return error_code
8*/
9int WaitToolDI(int id, byte status, int max_time, int opt);
5.17. Wait for control box analog input
1/**
2* @brief Waiting for control box analog input.
3* @param [in] id io number, range [0~1]
4* @param [in] sign 0-greater than, 1-less than
5* @param [in] value Input current or voltage value percentage, range [0~100] corresponding to current value [0~20mS] or voltage [0~10V]
6* @param [in] max_time Maximum wait time in ms
7* @param [in] opt Policy after timeout, 0-program stops and prompts for timeout, 1-ignore timeout and prompt program to continue, 2-always wait
8* @return error_code
9*/
10int WaitAI(int id, int sign, float value, int max_time, int opt);
5.18. Wait for tool analog input
1/**
2* @brief Waiting for tool analog input
3* @param [in] id io number, range [0]
4* @param [in] sign 0-greater than, 1-less than
5* @param [in] value Input current or voltage value percentage, range [0~100] corresponding to current value [0~20mS] or voltage [0~10V]
6* @param [in] max_time Maximum wait time in ms
7* @param [in] opt Policy after timeout, 0-program stops and prompts for timeout, 1-ignore timeout and prompt program to continue, 2-always wait
8* @return error_code
9*/
10int WaitToolAI(int id, int sign, float value, int max_time, int opt).
5.19. Wait for the control box digital, analog input signal code example
1private void btnIOTest_Click(object sender, EventArgs e)
2{
3 byte status = 1;
4 byte smooth = 0;
5 byte block = 0;
6 byte di = 0, tool_di = 0;
7 float ai = 0.0f, tool_ai = 0.0f;
8 float value = 0.0f;
9
10 int rtn = robot.WaitDI(0, 1, 1000, 1);
11 Console.WriteLine("WaitDI over; rtn is: " + rtn);
12
13 robot.WaitMultiDI(1, 3, 3, 1000, 1);
14 Console.WriteLine("WaitMultiDI over; rtn is: " + rtn);
15
16 robot.WaitToolDI(1, 1, 1000, 1);
17 Console.WriteLine("WaitToolDI over; rtn is: " + rtn);
18
19 robot.WaitAI(0, 0, 50, 1000, 1);
20 Console.WriteLine("WaitAI over; rtn is: " + rtn);
21
22 robot.WaitToolAI(0, 0, 50, 1000, 1);
23 Console.WriteLine("WaitToolAI over; rtn is: " + rtn);
24}
5.20. Set Whether Control Box DO Output Resets After Stop/Pause
1/**
2* @brief Set whether control box DO output resets after stop/pause
3* @param [in] resetFlag 0-Do not reset; 1-Reset
4* @param [in] reloadFlag Whether to reload after pause resume, 0-Do not load; 1-Load
5* @return Error code
6*/
7public int SetOutputResetCtlBoxDO(int resetFlag, int reloadFlag);
5.21. Set Whether Control Box AO Output Resets After Stop/Pause
1/**
2* @brief Set whether control box AO output resets after stop/pause
3* @param [in] resetFlag 0-Do not reset; 1-Reset
4* @param [in] reloadFlag Whether to reload after pause resume, 0-Do not load; 1-Load
5* @return Error code
6*/
7public int SetOutputResetCtlBoxAO(int resetFlag, int reloadFlag);
5.22. Set Whether End Tool DO Output Resets After Stop/Pause
1/**
2* @brief Set whether end tool DO output resets after stop/pause
3* @param [in] resetFlag 0-Do not reset; 1-Reset
4* @param [in] reloadFlag Whether to reload after pause resume, 0-Do not load; 1-Load
5* @return Error code
6*/
7public int SetOutputResetAxleDO(int resetFlag, int reloadFlag);
5.23. Set Whether End Tool AO Output Resets After Stop/Pause
1/**
2* @brief Set whether end tool AO output resets after stop/pause
3* @param [in] resetFlag 0-Do not reset; 1-Reset
4* @param [in] reloadFlag Whether to reload after pause resume, 0-Do not load; 1-Load
5* @return Error code
6*/
7public int SetOutputResetAxleAO(int resetFlag, int reloadFlag);
5.24. Set Whether Extended DO Output Resets After Stop/Pause
1/**
2* @brief Set whether extended DO output resets after stop/pause
3* @param [in] resetFlag 0-Do not reset; 1-Reset
4* @param [in] reloadFlag Whether to reload after pause resume, 0-Do not load; 1-Load
5* @return Error code
6*/
7public int SetOutputResetExtDO(int resetFlag, int reloadFlag);
5.25. Set Whether Extended AO Output Resets After Stop/Pause
1/**
2* @brief Set whether extended AO output resets after stop/pause
3* @param [in] resetFlag 0-Do not reset; 1-Reset
4* @param [in] reloadFlag Whether to reload after pause resume, 0-Do not load; 1-Load
5* @return Error code
6*/
7public int SetOutputResetExtAO(int resetFlag, int reloadFlag);
5.26. Set Whether SmartTool Output Resets After Stop/Pause
1/**
2* @brief Set whether SmartTool output resets after stop/pause
3* @param [in] resetFlag 0-Do not reset; 1-Reset
4* @param [in] reloadFlag Whether to reload after pause resume, 0-Do not load; 1-Load
5* @return Error code
6*/
7public int SetOutputResetSmartToolDO(int resetFlag, int reloadFlag);
5.27. Code Example for Setting Output Reset After Lua Program Stop/Pause
1public void TestDOReset()
2{
3 ROBOT_STATE_PKG pkg = new ROBOT_STATE_PKG();
4
5 for (int i = 0; i < 16; i++)
6 {
7 robot.SetDO(i, 1, 0, 0);
8 Thread.Sleep(200);
9 }
10
11 int resetFlag = 1;
12 int resumeReloadFlag = 1;
13 int rtn = robot.SetOutputResetCtlBoxDO(resetFlag, resumeReloadFlag);
14 robot.SetOutputResetCtlBoxAO(resetFlag, resumeReloadFlag);
15 robot.SetOutputResetAxleDO(resetFlag, resumeReloadFlag);
16 robot.SetOutputResetAxleAO(resetFlag, resumeReloadFlag);
17 robot.SetOutputResetExtDO(resetFlag, resumeReloadFlag);
18 robot.SetOutputResetExtAO(resetFlag, resumeReloadFlag);
19 robot.SetOutputResetSmartToolDO(resetFlag, resumeReloadFlag);
20
21 robot.ProgramLoad("/fruser/test.lua");
22 robot.ProgramRun();
23
24 Thread.Sleep(2000);
25 robot.PauseMotion();
26 Thread.Sleep(2000);
27 robot.ResumeMotion();
28 Thread.Sleep(2000);
29}
5.28. Set Configurable CI Port Functions of the Control Box
1/**
2* @brief Set configurable CI port functions of the control box
3* @param [in] config CI0-CI7 function codes;
4* 0-None;1-Arc start success;2-Welder ready;3-Conveyor detection;4-Pause;5-Resume;6-Start;7-Stop;
58-Pause/Resume;9-Start/Stop;10-Pedal drag;11-Move to home position;12-Manual/Auto switch;
613-Wire search success;14-Motion interrupt;15-Start main program;16-Start rewind;17-Start confirmation;
718-Photoelectric detection signal X;19-Photoelectric detection signal Y;20-External emergency stop input signal 1;21-External emergency stop input signal 2;
822-Level 1 reduction mode;23-Level 2 reduction mode;24-Level 3 reduction mode (Stop);25-Resume welding;26-Terminate welding;
927-Assist drag enable;28-Assist drag disable;29-Assist drag enable/disable;30-Clear all errors;
1031-Manual/Auto switch (high/low level);32-Enable;33-Disable;34-Enable/Disable (rising/falling edge);35-Fixed-point tracking start/end
11* @return Error code
12*/
13public int SetDIConfig(int[] config)
5.29. Get Configurable CI Port Functions of the Control Box
1/**
2* @brief Get configurable CI port functions of the control box
3* @param [in] config CI0-CI7 function codes;
4* 0-None;1-Arc start success;2-Welder ready;3-Conveyor detection;4-Pause;5-Resume;6-Start;7-Stop;
58-Pause/Resume;9-Start/Stop;10-Pedal drag;11-Move to home position;12-Manual/Auto switch;
613-Wire search success;14-Motion interrupt;15-Start main program;16-Start rewind;17-Start confirmation;
718-Photoelectric detection signal X;19-Photoelectric detection signal Y;20-External emergency stop input signal 1;21-External emergency stop input signal 2;
822-Level 1 reduction mode;23-Level 2 reduction mode;24-Level 3 reduction mode (Stop);25-Resume welding;26-Terminate welding;
927-Assist drag enable;28-Assist drag disable;29-Assist drag enable/disable;30-Clear all errors;
1031-Manual/Auto switch (high/low level);32-Enable;33-Disable;34-Enable/Disable (rising/falling edge);35-Fixed-point tracking start/end
11* @return Error code
12*/
13public int GetDIConfig(out int[] config)
5.30. Set Configurable CO Port Functions of the Control Box
1/**
2* @brief Set configurable CO port functions of the control box
3* @param [out] config CO0-CO7 function codes;
4* 0-None;1-Robot error;2-Robot in motion;3-Spray start/stop;4-Spray gun cleaning;5-Gas supply signal;6-Arc start signal;7-Jog wire feed;
58-Reverse wire feed;9-JOB input port 1;10-JOB input port 2;11-JOB input port 3;12-Conveyor start/stop control;13-Robot paused;14-Reached home position;
615-Reached interference area;16-Wire search start/stop control;17-Robot start completed;18-Program start/stop;19-Auto/Manual mode;20-Emergency stop output signal 1-Safety;
721-Emergency stop output signal 2-Safety;22-Lua script program running/stopped;23-Safety status output-Safety;24-Protective stop status output-Safety;
825-Robot in motion-Safety;26-Robot reduced mode-Safety;27-Robot non-reduced mode-Safety;28-Robot non-stopped;29-Robot error-Instruction point error;
930-Robot error-Driver error;31-Robot error-Soft limit exceeded error;32-Robot error-Collision error;33-Robot error-Active slave count error;
1034-Robot error-Slave error;35-Robot error-IO error;36-Robot error-Gripper error;37-Robot error-File error;38-Robot error-Singular pose error;
1139-Robot error-Driver communication error;40-Robot error-Parameter error;41-Robot error-External axis soft limit exceeded error;42-Robot warning-Warning;
1243-Robot warning-Safety door warning;44-Robot warning-Motion warning;45-Robot warning-Interference area warning;46-Robot warning-Safety wall warning;
1347-Enable status;48-Auto lift during disconnection;49-Cube 1 interference warning;50-Cube 2 interference warning;51-Cube 3 interference warning;52-Cube 4 interference warning;
14* @return Error code
15*/
16public int SetDOConfig(int[] config)
5.31. Get Configurable CO Port Functions of the Control Box
1/**
2* @brief Get configurable CO port functions of the control box
3* @param [out] config CO0-CO7 function codes;
4* 0-None;1-Robot error;2-Robot in motion;3-Spray start/stop;4-Spray gun cleaning;5-Gas supply signal;6-Arc start signal;7-Jog wire feed;
58-Reverse wire feed;9-JOB input port 1;10-JOB input port 2;11-JOB input port 3;12-Conveyor start/stop control;13-Robot paused;14-Reached home position;
615-Reached interference area;16-Wire search start/stop control;17-Robot start completed;18-Program start/stop;19-Auto/Manual mode;20-Emergency stop output signal 1-Safety;
721-Emergency stop output signal 2-Safety;22-Lua script program running/stopped;23-Safety status output-Safety;24-Protective stop status output-Safety;
825-Robot in motion-Safety;26-Robot reduced mode-Safety;27-Robot non-reduced mode-Safety;28-Robot non-stopped;29-Robot error-Instruction point error;
930-Robot error-Driver error;31-Robot error-Soft limit exceeded error;32-Robot error-Collision error;33-Robot error-Active slave count error;
1034-Robot error-Slave error;35-Robot error-IO error;36-Robot error-Gripper error;37-Robot error-File error;38-Robot error-Singular pose error;
1139-Robot error-Driver communication error;40-Robot error-Parameter error;41-Robot error-External axis soft limit exceeded error;42-Robot warning-Warning;
1243-Robot warning-Safety door warning;44-Robot warning-Motion warning;45-Robot warning-Interference area warning;46-Robot warning-Safety wall warning;
1347-Enable status;48-Auto lift during disconnection;49-Cube 1 interference warning;50-Cube 2 interference warning;51-Cube 3 interference warning;52-Cube 4 interference warning;
14* @return Error code
15*/
16public int GetDOConfig(out int[] config)
5.32. Set Configurable End-CI Port Functions of the End-Effector
1/**
2* @brief Set configurable End-CI port functions of the end-effector
3* @param [in] config End CI0-CI1 function codes;
4* 0-None;1-Drag teaching tool switch;2-Point recording signal;3-Manual/Auto switch (pulse signal);4-TPD recording start/stop;5-Pause motion;
56-Resume motion;7-Start;8-Stop;9-Pause/Resume;10-Start/Stop;11-Force sensor assist drag enable;12-Force sensor assist drag disable;
613-Force sensor assist drag enable/disable;14-Laser detection signal X;15-Laser detection signal Y;16-PTP motion to home position;17-Motion interrupt, stop current motion based on signal;
718-Start main program;19-Start rewind;20-Start confirmation;21-Resume welding;22-Terminate welding;23-Clear error;24-Manual/Auto switch (high/low level);
825-Enable;26-Disable;27-Enable/Disable;28-Laser servo tracking start/stop signal;
9* @return Error code
10*/
11public int SetToolDIConfig(int[] config)
5.33. Get Configurable End-CI Port Functions of the End-Effector
1/**
2* @brief Get configurable End-CI port functions of the end-effector
3* @param [out] config End CI0-CI1 function codes;
4* 0-None;1-Drag teaching tool switch;2-Point recording signal;3-Manual/Auto switch (pulse signal);4-TPD recording start/stop;5-Pause motion;
56-Resume motion;7-Start;8-Stop;9-Pause/Resume;10-Start/Stop;11-Force sensor assist drag enable;12-Force sensor assist drag disable;
613-Force sensor assist drag enable/disable;14-Laser detection signal X;15-Laser detection signal Y;16-PTP motion to home position;17-Motion interrupt, stop current motion based on signal;
718-Start main program;19-Start rewind;20-Start confirmation;21-Resume welding;22-Terminate welding;23-Clear error;24-Manual/Auto switch (high/low level);
825-Enable;26-Disable;27-Enable/Disable;28-Laser servo tracking start/stop signal;
9* @return Error code
10*/
11public int GetToolDIConfig(out int[] config)
5.34. Set Configurable CI Active State of the Control Box
1/**
2* @brief Set configurable CI active state of the control box
3* @param [in] config CI0-CI7 port active state; 0-active high; 1-active low
4* @return Error code
5*/
6public int SetDIConfigLevel(int[] config)
5.35. Get Configurable CI Active State of the Control Box
1/**
2* @brief Get configurable CI active state of the control box
3* @param [out] config CI0-CI7 port active state; 0-active high; 1-active low
4* @return Error code
5*/
6public int GetDIConfigLevel(out int[] config)
5.36. Set Configurable CO Active State of the Control Box
1/**
2* @brief Set configurable CO active state of the control box
3* @param [in] config CO0-CO7 port active state; 0-active high; 1-active low
4* @return Error code
5*/
6public int SetDOConfigLevel(int[] config)
5.37. Get Configurable CO Active State of the Control Box
1/**
2* @brief Get configurable CO active state of the control box
3* @param [out] config CO0-CO7 port active state; 0-active high; 1-active low
4* @return Error code
5*/
6public int GetDOConfigLevel(out int[] config)
5.38. Set Configurable CI Active State of the End-Effector
1/**
2* @brief Set configurable CI active state of the end-effector
3* @param [in] config CI0-CI1 port active state; 0-active high; 1-active low
4* @return Error code
5*/
6public int SetToolDIConfigLevel(int[] config)
5.39. Get Configurable CI Active State of the End-Effector
1/**
2* @brief Get configurable CI active state of the end-effector
3* @param [out] config CI0-CI1 port active state; 0-active high; 1-active low
4* @return Error code
5*/
6public int GetToolDIConfigLevel(out int[] config)
5.40. Set Standard DI Active State of the Control Box
1/**
2* @brief Set standard DI active state of the control box
3* @param [in] config DI0-DI7 port active state; 0-active high; 1-active low
4* @return Error code
5*/
6public int SetStandardDILevel(int[] config)
5.41. Get Standard DI Active State of the Control Box
1/**
2* @brief Get standard DI active state of the control box
3* @param [out] config DI0-DI7 port active state; 0-active high; 1-active low
4* @return Error code
5*/
6public int GetStandardDILevel(out int[] config)
5.42. Set Standard DO Active State of the Control Box
1/**
2* @brief Set standard DO active state of the control box
3* @param [in] config DO0-DO7 port active state; 0-active high; 1-active low
4* @return Error code
5*/
6public int SetStandardDOLevel(int[] config)
5.43. Get Standard DO Active State of the Control Box
1/**
2* @brief Get standard DO active state of the control box
3* @param [out] config DO0-DO7 port active state; 0-active high; 1-active low
4* @return Error code
5*/
6public int GetStandardDOLevel(out int[] config)
5.44. Robot IO Configuration Code Example
1public void TestIOConfig()
2{
3 int rtn = 0;
4
5 // ---------- Test configurable CI port functions ----------
6 int[] setDIConfig = new int[] { 3, 9, 1, 4, 5, 6, 7, 8 };
7 rtn = robot.SetDIConfig(setDIConfig);
8 Console.WriteLine($"SetDIConfig rtn is {rtn}");
9
10 // Use out parameter to receive the obtained configuration array
11 int[] getDIConfig;
12 rtn = robot.GetDIConfig(out getDIConfig);
13 Console.WriteLine($"GetDIConfig rtn is {rtn}, value is {string.Join(" ", getDIConfig)}");
14
15 // ---------- Test configurable CO port functions ----------
16 int[] setDOConfig = new int[] { 9, 10, 11, 12, 13, 14, 15, 16 };
17 rtn = robot.SetDOConfig(setDOConfig);
18 Console.WriteLine($"SetDOConfig rtn is {rtn}");
19
20 int[] getDOConfig;
21 rtn = robot.GetDOConfig(out getDOConfig);
22 Console.WriteLine($"GetDOConfig rtn is {rtn}, value is {string.Join(" ", getDOConfig)}");
23
24 // ---------- Test configurable End-CI port functions of the end-effector ----------
25 int[] setToolDIConfig = new int[] { 17, 18 };
26 rtn = robot.SetToolDIConfig(setToolDIConfig);
27 Console.WriteLine($"SetToolDIConfig rtn is {rtn}");
28
29 int[] getToolDIConfig;
30 rtn = robot.GetToolDIConfig(out getToolDIConfig);
31 Console.WriteLine($"GetToolDIConfig rtn is {rtn}, value is {string.Join(" ", getToolDIConfig)}");
32
33 // ---------- Test configurable CI active state of the control box ----------
34 int[] setDIConfigLevel = new int[] { 1, 1, 1, 1, 0, 0, 0, 0 };
35 rtn = robot.SetDIConfigLevel(setDIConfigLevel);
36 Console.WriteLine($"SetDIConfigLevel rtn is {rtn}");
37
38 int[] getDIConfigLevel;
39 rtn = robot.GetDIConfigLevel(out getDIConfigLevel);
40 Console.WriteLine($"GetDIConfigLevel rtn is {rtn}, value is {string.Join(" ", getDIConfigLevel)}");
41
42 // ---------- Test configurable CO active state of the control box ----------
43 int[] setDOConfigLevel = new int[] { 0, 0, 0, 0, 1, 1, 1, 1 };
44 rtn = robot.SetDIConfigLevel(setDOConfigLevel);
45 Console.WriteLine($"SetDOConfigLevel rtn is {rtn}");
46
47 int[] getDOConfigLevel;
48 rtn = robot.GetDOConfigLevel(out getDOConfigLevel);
49 Console.WriteLine($"GetDOConfigLevel rtn is {rtn}, value is {string.Join(" ", getDOConfigLevel)}");
50
51 // ---------- Test configurable CI active state of the end-effector ----------
52 int[] setToolDIConfigLevel = new int[] { 1, 0 };
53 rtn = robot.SetToolDIConfigLevel(setToolDIConfigLevel);
54 Console.WriteLine($"SetToolDIConfigLevel rtn is {rtn}");
55
56 int[] getToolDIConfigLevel;
57 rtn = robot.GetToolDIConfigLevel(out getToolDIConfigLevel);
58 Console.WriteLine($"GetToolDIConfigLevel rtn is {rtn}, value is {string.Join(" ", getToolDIConfigLevel)}");
59
60 // ---------- Test standard DI active state of the control box ----------
61 int[] setStandardDILevel = new int[] { 1, 1, 1, 1, 0, 0, 0, 0 };
62 rtn = robot.SetStandardDILevel(setStandardDILevel);
63 Console.WriteLine($"SetStandardDILevel rtn is {rtn}");
64
65 int[] getStandardDILevel;
66 rtn = robot.GetStandardDILevel(out getStandardDILevel);
67 Console.WriteLine($"GetStandardDILevel rtn is {rtn}, value is {string.Join(" ", getStandardDILevel)}");
68
69 // ---------- Test standard DO active state of the control box ----------
70 int[] setStandardDOLevel = new int[] { 0, 0, 0, 0, 1, 1, 1, 1 };
71 rtn = robot.SetStandardDOLevel(setStandardDOLevel);
72 Console.WriteLine($"SetStandardDOLevel rtn is {rtn}");
73
74 int[] getStandardDOLevel;
75 rtn = robot.GetStandardDOLevel(out getStandardDOLevel);
76 Console.WriteLine($"GetStandardDOLevel rtn is {rtn}, value is {string.Join(" ", getStandardDOLevel)}");
77
78}