SlaveIP (use commas, not periods)
SlavePort (502 is modbus port - SA cmd will not work over Modbus)
SlaveHandleLetter (A,B,C, etc...)
Slave Base Address (If SlaveHandle1Letter=A, Base=1;SlaveHandle1Letter=B, Base=2, etc...)
Enable Slave?

Download the following code and run from the MASTER controller

'*************************************
'Description-
'Master-Slave RIO Communication
'Master initiates connection and 
'sends IO requests to slave.
'Errors out if no comm possible.
'Requires static IP on master & slave
'*************************************
#AUTO
'close TCP connection
WT 1000
REM IHC= >-2               
REM IHD= >-2
REM IHE= >-2
REM IHF= >-2
MW1;  'modbus wait ON
'*************************************
REM JP_XQ0-1,_IHC2<>0
REM JP_XQ0-1,_IHD2<>0
REM JP_XQ0-1,_IHE2<>0
REM JP_XQ0-1,_IHF2<>0
'open new connection to slave RIO
REM IHC= 192,168,1,26<6000>2;WT25
REM IHD= 192,168,1,27<6001>2;WT25
REM IHE= 192,168,1,28<6002>2;WT25
REM IHF= 192,168,1,29<6003>2;WT25
t_out= TIME+2000
#l
t= TIME
JP #error,t>t_out
REM JP #l,(_IHC2<>-2)
REM JP #l,(_IHD2<>-2)
REM JP #l,(_IHE2<>-2)
REM JP #l,(_IHF2<>-2)
'display message and blink slave bit1
MG "SLAVE(s) CONNECTED"
flag=1
MG "Set flag=x where x is 1-6"
'*************************************
#main
JS#setdout,flag=1
JS#getdin,flag=2
JS#getdout,flag=3
JS#Aout,flag=4
JS#getAin,flag=5
JS#SAcmd,flag=6
WT100
JP#main
'*************************************
#getdin
'query dig input on slave(s)
REM MG "Slv1 Digital Input=",@IN[3001]
REM MG "Slv2 Digital Input=",@IN[4001]
REM MG "Slv3 Digital Input=",@IN[5001]
REM MG "Slv4 Digital Input=",@IN[6001]
WT100
EN
'*************************************
#setdout
'set/clear dig output on slave
REM SB 3001
REM SB 4001
REM SB 5001
REM SB 6001
WT 1000
REM CB 3001
REM CB 4001
REM CB 5001
REM CB 6001
WT 1000
EN
'*************************************
#getdout
'query dig output on slave
REM MG "Slv1 Digital Output=",@OUT[3001]
REM MG "Slv2 Digital Output=",@OUT[4001]
REM MG "Slv3 Digital Output=",@OUT[5001]
REM MG "Slv4 Digital Output=",@OUT[6001]
WT100
EN
'*************************************
#Aout
'set/get Analog output on slave
REM AO3001,2
REM AO4001,2
REM AO5001,2
REM AO6001,2
WT10
REM MG@AO[3001]
REM MG@AO[4001]
REM MG@AO[5001]
REM MG@AO[6001]
WT100
REM AO3001,0
REM AO4001,0
REM AO5001,0
REM AO6001,0
EN
'*************************************
#getAin
'get Analog input on slave
REM MG"Slv1 AN1= ",@AN[3001]
REM MG"Slv2 AN1= ",@AN[4001]
REM MG"Slv3 AN1= ",@AN[5001]
REM MG"Slv4 AN1= ",@AN[6001]
WT100
EN
'*************************************
#SAcmd
'request TIME of slave
REM SAC="MG TIME"
REM SAD="MG TIME"
REM SAE="MG TIME"
REM SAF="MG TIME"
WT10
REM MG"Slv1 TIME= ",_SAC0
REM MG"Slv2 TIME= ",_SAD0
REM MG"Slv3 TIME= ",_SAE0
REM MG"Slv4 TIME= ",_SAF0
EN
'*************************************
#error
'display error and blink master bit4
MG "ERROR CONNECTING TO SLAVE"
#e
SB 4
WT 200
CB 4
WT 200
JP #e
EN
'*************************************
#TCPERR
MG "TCPERR, error code",_TC1
HX
EN
'*************************************
#CMDERR
MG "Command Error on line",_ED
MG "Error",_TC
IF ((_TC>=120)&(_TC<=130))
 MG "Communication Error"
ENDIF
HX
RE
'*************************************