modbus communication -pg电子麻将胡了
industrial communication toolbox™ supports the modbus interface over tcp/ip or serial rtu. you can use it to communicate with modbus servers, such as controlling a plc, communicating with a temperature controller, controlling a stepper motor, sending data to a dsp, reading bulk memory from a pac controller, or monitoring temperature and humidity on a modbus probe.
create the interface object using the modbus function,
and use the read, write,
writeread, and maskwrite functions
for communication.
for an example that shows the entire workflow of reading a register from a plc, see .
you can also read and write to coils and registers using the modbus explorer, which offers a graphical user interface to easily set up reads and writes, and a live plot to see the values. for information, see . for an example that shows the entire workflow of reading and writing to a plc using the app, see .
functions
| create modbus object | |
| read data from modbus server | |
| perform a write operation to the connected modbus server | |
| perform write and read operation on groups of holding registers in single modbus transaction | |
| perform mask write operation on a holding register |
apps
| read and write to modbus coils and registers |
topics
modbus communication using programmatic workflow
use industrial communication toolbox modbus support to communicate with modbus servers and applications over tcp/ip or serial rtu.- create a modbus connection
create a modbus object with themodbusfunction, to connect to a modbus interface.
use properties to set up modbus communication during or after object creation.
use themodbusobject to read coil, input, and register data from the modbus server.
read temperature and humidity measurements from a remote sensor on a plc connected via tcp/ip.
use themodbusobject to write coil and holding register data to the modbus server.
perform a combination of one write operation and one read operation on groups of holding registers in a single modbus transaction.
apply and and or masks to the current contents of a holding register.
modbus communication using the modbus explorer
you can read and write to coils and registers using the modbus explorer app.
configure communication with the device, either over tcp/ip or serial rtu.- read coils, inputs, and registers in the modbus explorer
read coils, inputs, input registers, and holding registers, similar to the functionality of the modbusreadfunction.
write to coils and holding registers, similar to the functionality of the modbuswritefunction.
perform reads and writes to a plc using the modbus explorer.
generate a matlab® script from your session to run at the command line.
troubleshooting
try these tips if you have problems using the toolbox modbus interface. see information about modbus supported platforms, configuration and connection, and other interface-specific tips.