![Galil Motion Control RIO-47 series
RIO-47100 Скачать руководство пользователя страница 24](http://html1.mh-extra.com/html/galil-motion-control/rio-47-series-rio-47100/rio-47-series-rio-47100_user-manual_558776024.webp)
Example #1 – Using Methods 1 and 2 to set Outputs
This example shows how a RIO master might connect to another slave RIO and toggle it's outputs on
using Method 1 and Method 2 described above.
Method 1
1. Begin by opening a connection to the slave assuming it has the IP address 192.168.1.120. This
command would be issued to the RIO Master:
IHB=192,168,1,120<502>2
This command opens a Modbus connection to the slave on handle “B”.
2. Set the outputs using the SB command, these commands are issued to the RIO Master:
SB 2001;SB 2003;SB 2005;SB 2007
Note that the “2000” designates the command is to the Modbus slave connected through handle
“B” and that slave's outputs 1, 3, 5, and 7 are toggled “on” by the SB command from the master.
Method 2
Assume that the handle is still open from the “IHB” command above, but that the outputs are
now turned off. It is desired to set the same outputs but instead using the MB command.
1. Dimension an array to store the commanded values. Set array element 0 equal to 170. Note
that array element 0 configures digital outputs 7-0. The following commands would be sent to
the RIO master:
DM myarray[2]
myarray[0]= 170
Note: 170 is 10101010 in binary meaning outputs 1, 3, 5, and 7 would be toggled “on” where the
remaining would be turned “off” or remain “off”.
2. Send the appropriate MB command. Use function code 15 for setting outputs. The following
command would be issued to the RIO master:
MBB=,15,0,16,myarray[]
Both 1 and 2 will result in the same outputs being toggled. The only difference is that Method 2
uses a single command to toggle all outputs both
on and off
; Whereas, SB can only toggle and
individual output on at a time and CB is used to turn those outputs off.
Example #2 – Using Method 2 to read analog inputs
Assume an RIO master is connecting as a Modbus master to a 3rd party PLC. The RIO will read the
value of analog inputs 3 and 4 on the PLC located at addresses 40006 and 40008, respectively.
Address information can be found in the PLC manufacturers documentation. Assume the PLC stores
values as 32-bit floating point numbers, which is common.
1. Begin by opening a connection to the PLC which has an IP address of 192.168.1.10. This
command is issued on the RIO master:
IHB=192,168,1,10<502>2
2. Dimension an array to store the results, this command is issued to the RIO master:
DM myanalog[4]
Chapter 3 Communication ▫ 24 RIO-47xxx Rev. 1.0r