![Campbell CR6 Series Скачать руководство пользователя страница 110](http://html1.mh-extra.com/html/campbell/cr6-series/cr6-series_product-manual_3769841110.webp)
To communicate over a serial port, it is important to be familiar with protocol used by the device
with which you will be communicating. Refer to the manual of the sensor or device to find its
protocol and then select the appropriate options for each CRBasic parameter. See the application
note
Interfacing Serial Sensors with Campbell Scientific Dataloggers
for more programming
details and examples.
7.2 Modbus communications
The data logger supports Modbus RTU, Modbus ASCII, and Modbus TCP protocols and can be
programmed as a Modbus master or Modbus slave. These protocols are often used in SCADA
networks. Data loggers can communicate using Modbus on all available communication ports.
The data logger supports RTU and ASCII communication modes on RS-232 and RS-485
connections.
CRBasic Modbus instructions include:
l
ModbusMaster()
l
ModbusSlave()
l
MoveBytes()
See the CRBasic Editor help for detailed instruction information and program examples:
https://help.campbellsci.com/crbasic/cr6/.
For additional information on Modbus, see:
l
l
Why Modbus Matters: An Introduction
l
How to Access Live Measurement Data Using Modbus
l
Using Campbell Scientific Dataloggers as Modbus Slave Devices in a SCADA Network
Because Modbus has a set command structure, programming the data logger to get data from
field instruments can be much simpler than from some other serial sensors. Because Modbus uses
a common bus and addresses each node, field instruments are effectively multiplexed to a data
logger without additional hardware.
When doing Modbus communications over RS-232, the data logger, through Device
Configuration Utility or the Settings editor, can be set to keep communication ports open and
awake, but at higher power usage. Set RS-232Power to Always on. Otherwise, the data logger
goes into sleep mode after 40 seconds of communications inactivity. Once asleep, two packets
are required before it will respond. The first packet awakens the data logger; the second packet is
received as data. This would make a Modbus master fail to poll the data logger, if not using
retries.
7. Communications protocols
92