'************************************
'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 on B handle
WT 2000
IHB= >-2
#w
JP #w,_IHB2<>0
'open new connection to slave RIO
'replace with correct IP address
IHB= 192,168,2,3<502>2;  'modbus port
t_out= TIME+5000
#l
t= TIME
JP #error,t>t_out
JP #l,(_IHB2<>-2)
'display message and blink slave bit1
MG "SLAVE CONNECTED"
#n
SB 2001
WT 200
CB 2001
WT 200
JP #n
#error
'display error and blink master bit4
MG "ERROR CONNECTING TO SLAVE"
#e
SB 4
WT 200
CB 4
WT 200
JP #e
EN