Content
Dependencies
Functions
Command list
Command description
Default values
State machine
Sample overview
State description
Taks list
State list
Error codes
Dependencies
MTOV2 librarys define. (DownLoad)
T5BLOCKS.dll version 2.0 or higher.
Functions
MTOV2_main
There has to be one instance of this function, and only one. Call this
in every scan of the plc.
This functions takes no parameters.
| Input |
| Paramater
name |
Type |
Description |
|
|
|
| Output |
| Paramatername |
Type |
Description |
|
|
|
MTOV2_command
This function is used to active different commands to the interface.
| Input |
| Paramater
name |
Type |
Description |
| RobID |
DINT |
Id of the robot the command is for. See command
list
MTOV2_CMD_SETCLIENT |
| Cmd |
DINT |
Command to state machine |
| DataIn |
STRING |
Data to state machine if supported by the
command. See
command list |
|
|
|
| Output |
| Paramatername |
Type |
Description |
| DataOut |
STRING |
Output from command if supported by command |
| ErrorOut |
DINT |
Error if command not success full on completion |
| StateOut |
DINT |
State and task. See state description. |
Command
List
This is a list of possible command that can be sent to the interface.
The list can be copied into the PLC project.
See command table for
explanation and use.
#define
MTOV2_CMD_NONE
0 //Nothing. just status
#define
MTOV2_CMD_SETCLIENT 1 //activate Ip
adress
#define
MTOV2_CMD_KEEPCON 2 //Keep
interface connected to controler
#define
MTOV2_CMD_COMMAND 10 //Send
command to robot
#define
MTOV2_CMD_PUTJOBFILE 11 //Load file to controler
#define
MTOV2_CMD_GETJOBFILE 12 //Get file from controler
#define
MTOV2_CMD_SETOUTPUT 13 //Set Output
#define
MTOV2_CMD_GETINPUT
14 //Read input
#define
MTOV2_CMD_SETSTATE
20 //Force state (for
debuggin)
#define
MTOV2_CMD_GETRESULT 30 //Get result from
a command
#define
MTOV2_CMD_GETRESSIZE 31 //Get size of result
#define
MTOV2_CMD_STATEDISC 40 //Disconnect to
controler
#define
MTOV2_CMD_GETFILESIZE 41 //Get size of last transmittet file
#define
MTOV2_CMD_SETRETRY 50 //Set
max numbers
of retry when robot not responding
#define
MTOV2_CMD_SETTIMEOUT 51 //Set max time to wait for robot
respond before retry
#define
MTOV2_CMD_SETIDLETIME 52 //Set time to stay connectet without activity
#define
MTOV2_CMD_PUTSPFILE 60 //Put special
file to
controler
#define
MTOV2_CMD_GETSPFILE 61 //Get special
file from
controler
#define
MTOV2_CDM_SPECIALCMD 62 //Special command to controler
| MTOV2_CMD_NONE |
| This
functions does nothing exept read out stateout |
| RobID |
identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
Not used |
|
|
| DataOut |
Not used |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_SETCLIENT |
| Use
this command to get a robot identification code (RobID) |
| RobID |
Not used |
| Cmd |
See command list for DINT value |
| DataIn |
Ip address of the robot you wish to connect to. |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
Not used
|
| MTOV2_CMD_KEEPCON |
Reset
the
counter that disconnect to robot. If state is ready this will not go to
IDLE state if this is called before IDLETIME from the last
transmission with the robot.
This only has effect when the state is “READY” |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
Not used |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_COMMAND |
Send
a command to a robot. Call until dataout is “1”
This only has effect when the Task is “NONE”
Done when task returns to “NONE” |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
Data for robot |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_PUTJOBFILE |
Send
job to controller. Call until dataout is “1”
This only has effect when the Task is “NONE”
Done when task returns to “NONE” |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
Full path to file to send to robot. |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_GETJOBFILE |
Get
a job from the controller. Call until dataout is “1”
This only has effect when the Task is “NONE”
Done when task returns to “NONE” |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
Full path of the location the file will be
placed, and
job name to get.
E.G. “C:\PLC\SOFTNC\PRG\MYJOB.JBI”.
This would get the MYJOB from the controller if exist. |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_SETOUTPUT |
Write
output on controller.
Call until dataout is “1”
This only has effect when the Task is “NONE”
Done when task returns to “NONE” |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
See motoman manual for syntax |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_GETINPUT |
Get
status for input or output
Call until dataout is “1”
This only has effect when the Task is “NONE”
Done when task returns to “NONE” |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
See motoman manual for syntax |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_SETSTATE
|
Force
a state to the state machine. Only for debugging.
Call until dataout is “1” |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
New value for state machine. Same syntax as
“stateOut” |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_GETRESULT |
Read
result from result buffer. If a command generates a result from the
controller, it can be read by this command.
Result can be invalid if Task is other then “NONE” |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
Start byte. First byte is “0”. The size of the
result
buffer can be read with MTOV2_CMD_GETRESSIZE. |
|
|
| DataOut |
Data from result buffer. If empty, no data
available
from start point. |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_GETRESSIZE |
| Read
size of data in result buffer. |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
Not used |
|
|
| DataOut |
Size of result in result buffer. See
MTOV2_CMD_GETRESULT |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_STATEDISC |
Force
the state machine to go from “Ready” to “Idle” without waiting for
Idletimer.
Call until dataout is “1”
This only has effect when the Task is “NONE” and state “Ready” |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
Not used |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_GETFILESIZE |
Get
file size of last transmitted file. Updated during load.
Filesize is reset ad next task involving file transfer. |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
Not used |
|
|
| DataOut |
Number of bytes transferred. |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_SETRETRY |
Set
number of retry when robot does not respond as expected.
0 = no retry. |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
Number of retrys. |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_SETTIMEOUT |
| Set
time out value. The time to wait for robot to answer before error, or
retransmit. |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
Timeout in milliseconds |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_SETIDLETIME |
| Set
the time the state machine waits in state “Ready” before disconnecting
the connection to the robot, and goes to state “Idle” |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
Timeout in milliseconds |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_
PUTSPFILE |
Send
a file to the controller that requires a special header in the command
message. Se manual Motoman Ethernet manual for more info.
Call until dataout is “1”
This only has effect when the Task is “NONE”
Done when task returns to “NONE”. |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
First 6 chars is header. Rest is full path to
file to
send to robot.
E.G. :”02,232 C:\PLC\SOFTNC\PRG\VAR.DAT” This command will send the
data file to the robot if it exist and you have the right privileges. |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_
GETSPFILE |
Get
a file from the controller that requires a special header in the
command message. Se manual Motoman Ethernet manual for more
info.
Call until dataout is “1”
This only has effect when the Task is “NONE”
Done when task returns to “NONE” |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
First 6 chars is header E.G. “02,332”.
Rest
is full path to requested file location
Full path of the location the file will be placed, and file name to
get.
E.G. “C:\PLC\SOFTNC\PRG\VAR.DAT”.
This would get the VAR.DAT from the controller. |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
| MTOV2_CMD_SPECIALCMD |
Send
a command to a robot that requires special header in the command
message. Se manual Motoman Ethernet manual for more info.
. Call until dataout is “1”
This only has effect when the Task is “NONE”
Done when task returns to “NONE” |
| RobID |
robot identification code returned by
MTOV2_CMD_SETCLIENT |
| Cmd |
See command list for DINT value |
| DataIn |
First 6 chars is header E.G. “02,332”.
Rest is data for robot. |
|
|
| DataOut |
“1” OK, “0” fail |
| ErrorOut |
Error code |
| StateOut |
State for RobID. See state description |
Default values
| Parm |
Description |
Value |
unit |
| Retry |
Number of retry before error report |
? |
- |
| Timeout |
Time to wait for robot to respond |
? |
ms |
IdleTime
|
Time to stay in state “Ready” before going to
state
“Idle”
|
? |
ms |
State machine

Sample
overview
State description
State
out
is a value build from 3 different parameters.
Bit
|
|
|
| 0-7 |
Substate
|
Not described. Only for debugging
|
| 8-15 |
State |
State of state machine. See graphics. |
| 16-23 |
Task
|
Task of state machine.
|

Task list
| NONE |
16#00 |
no command |
| CMD |
16#01 |
Send command to controler
|
| GETJOBFILE |
16#02 |
Get file from controler |
| PUTJOBFILE |
16#03 |
Send file to controler |
| GETDATFILE |
16#04 |
Get file from controler
|
PUTCNDFILE
|
16#05 |
Send file to controler
|
SETOUTPUT
|
16#06 |
Set Output
|
State list
| IDLE |
16#01 |
| CONNET |
16#02 |
| HOST |
16#03 |
| ROBOT |
16#04 |
| ERROR |
16#05 |
| READY |
16#06 |
| DISCON |
16#07 |
Error codes
| Code |
Description |
| -10001 |
Request connection error |
| -10002 |
Request service error |
| -10003 |
Request stop error |
| -10004 |
Disconnect error |
| -10005 |
Enquiry error |
| -10006 |
Send ENQ failed |
| -10007 |
End of transmission |
| -10008 |
acknolegde error |
| -10010 |
responce error. |
| -10011 |
Could not open file |
| -10012 |
responce error. |
| -10013 |
error creating file |
| -10014 |
transmision timeout |
| -10017 |
Incorrect response to robot data |
| -10018 |
Incorrect response to ACK |
| -10019 |
Incorrect response to data header message |
| -10020 |
Error opening UDP port 10000 |
| -10021 |
Error opening UDP port 10006 |
| -10031 |
Robot responded with ENQ out of context |
| -10040 |
Memory allocation error. |
| -10041 |
No vacant ID. To many connected robots |
| -10042 |
Id not valid. No IP associated with ID |
| -10050 |
Main MTOV2 function allocated. |
|