Beruflich Dokumente
Kultur Dokumente
06/2009
TECHNICAL NOTE
In This Document
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
TheModbusMessage.................................................. 3
ModbusMapsforIONMeters........................................... 5
ION and Modbus in Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Scenario1:IONMetersinaModbusNetwork ............................. 6
Scenario2:ModbusDevicesinanIONEnterpriseNetwork ................. 7
Scenario3:IONMeterasModbusMaster ................................. 8
Scenario4:EtherGateandModbusRTU................................. 10
Scenario5:IONMeterasModbusGateway.............................. 10
ION Meters as a Modbus Master . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
IONModulesforModbusMaster ....................................... 11
MultiportSerialModbusMaster ........................................ 15
Introduction
Introduction
Modbusisaprotocolusedinindustrialmanufacturing.Itwascreatedtotransfer
controldatabetweencontrollersandsensorsusingRS232serialports.The
Modbusprotocoliswidelyusedandsupportedonserial(RS232andRS485)and
Ethernet(TCP/IP)connections.
Modbusisamaster/slaveprotocolwherethemasterinitiatestransactionsandthe
slavesrespondwiththerequesteddataoraction.Modbusmastersareusually
softwareprograms,suchasDistributedControlSystems(DCS).However,masters
canalsobedevicessuchasremoteterminalunits(RTU),programmablelogic
controllers(PLC)orIONmeters.ModbusslavesaredevicessuchasPLCs,
I/O monitoringdevices,relays,softwareandIONmeters.
IONmeters,whenusedasModbusmasterorslavedevices,providesensingfor
yourModbusnetworksoyoucanquicklyviewandrespondtopowerdataand
equipmentstatusinformation.
Modbus RTU and Modbus ASCII
TheModbusprotocolhastwobasicforms.TheRTUorBinaryformandtheASCII
form.TheASCIIformtransmitsallbytesusingtheASCIIcharacterset(09and
AF).TheRTUformtransmitsallbytesinabinaryformatmakingtheprotocol
fasterandmoreefficient.Bothformsareserial(RS232/RS485)protocols.
Whicheverformisused,boththemasterandtheslavesmustusethesameform.
Modbus Plus
ModbusPlusisaproprietaryModiconprotocolusedinindustrialnetworking
systems.Itusestokenpassingpeertopeercommunicationsatadatatransferrate
ofonemegabitpersecond(highspeedpassingofgroupsofbitswithinalayer).
Thenetworkmediumisshieldedtwistedpaircable.
Modbus/TCP
Modbus/TCPdefinesthepacketstructureandconnectionport(port502)forthe
industrystandardTCP/IPprotocol.ThestructureofaModbus/TCPpacketisvery
similartotheModbusRTUpacketexceptthatithasanextrasixbyteheaderand
doesnotrequirethecyclicredundancycheck(CRC).SomeIONfirmwaresupports
Modbus/TCPfordirectcommunicationswiththemeter,aswellasforuseina
Modbusgateway.
Modbus/TCPretainstheModbusRTUlimitof256bytestoapacket.Itissuggested
thathigherthroughputispossibleifthislimitationisremoved.Thisvariantis
calledEnhancedModbus/TCPbut,sofar,fewdeviceshavemovedtosupportit.
NOTE
Some devices support multiple simultaneous Modbus/TCP connections. If you are trying to connect to one
of these meters, it can take some time. Adjust your network timeout settings to accommodate this.
Page 2
Description
Slave Address
Function Code
Data
Checksum
Unit ID 0 (zero) is also allowed. This sends a broadcast message to all slave meters.
IONmetersarepreconfiguredwithaunitIDthatyoucanchangefromthefront
panelofthemeterorviasoftware.ThisunitIDservesastheslaveaddressthatthe
masterusestodeterminewhichslavetocommunicatewith.
ThefunctioncodeusedisbasedonthevariabletypethataparticularION meter
supports,andwhethertheIONmeterisactingasamasteroraslave.
Variable Types
ThebasicModbusmessagebuildingblocksarecalledvariabletypes.Variable
typesgroupdataintoaddressrangesthatperformcertainfunctions(using
functioncodes).Forexample,Coilregistershaveanaddressrangefrom00001to
09999andthedatathatmakesupthemessagecanbereadorwrittento(Function
1,5and15).
TherearefourmainclassesofModbusdata,orvariabletypes,thatsupport
differentfunctioncodes.Coilandinputregistersaresinglebitregistersusedto
indicateONorOFFconditions.Inputandholdingregistersare16bitregisters
usedtostoreandretrievedata.
Variable
Description
Address Change
Coils
Function 1, 5, 15
00001 to 09999
Input Status
Function 2
10001 to 19999
Input Registers
Function 4
30001 to 39999
Holding Registers
Function 3, 6 and 16
40001 to 49999
Page 3
Function Codes
IONmeters(actingasmasterorslave)useIONmodules(ModbusMasterDevice,
ModbusMasterMapping,ModbusImport,ModbusExportandModbusSlave
modules)tosupportthefollowingfunctioncodes:
Function
ION master or
slave function
Description
Function 1
Master
Function 2
Master
Function 3
Function 4
Master
Function 5
Write to a Coil
Master
Modbus Export
Function 6
Master
Modbus Export
Function 15
Master
Modbus Export
Function 16
The Modbus Master Map module and the Modbus Master Device module work together, and reference
the settings in Modbus Master Options module; you need all modules configured properly for this
feature to work.
ThemaximumnumberofModbusregistersthemodulecanreadatonce(per
request)dependsontheModbusformatanddataregistertype.Modbussupports
acombinationof16bitdatatypes.Thesedataformatsuseoneortwo16bitwords
toencodesigned/unsignedorinteger/floatingpointnumbers:
Format
Page 4
Type
Unsigned 16-bit
Integer
Signed 16-bit
Integer
Unsigned 32-bit
Integer
Signed 32-bit
Integer
Integer
Integer
IEEE Float1
Floating point
Packed Boolean
Integer
ION meters acting as Modbus masters support two versions of IEEE Float with different word orders:
high/low = Big Endian, low/high = Little Endian. Big Endian/Little Endian is supported for all 32-bit
formats by ION meters acting as Modbus masters.
Register 44590
Register 42001
Register 44476
IONmetersalsoprovideaflexiblemapthatyoucanuseforreadingdata.The
flexibleModbusmapletsyoureadvariousIONregisterswithModbusmaster
devicesbycorrelatingtheModbusregisternumberwiththeaddressoftheION
register(ontheslave)youwanttoread.WhenaModbusmasterrequeststoread
aregister,thecorrespondingIONregisterdataisreturned.
Flexible Modbus Map
Modbus Slave module
input register
Vln a
Vln a
output register
setup registers
Register 40011
Vln b
...
FormoreinformationontheModbusflexiblemapforIONmeters,seetheCommon
ModbusRegistersdocumentandAppendixEoftheION7300SeriesModiconModbus
SerialCommunicationsProtocoldocument.
NOTE
If you have Advanced security enabled, you must configure the Modbus Map Access register to allow write
access for specific users. See the Security Options module description in the ION Reference. If you have
Standard or Advanced security enabled on the meter, you can only read Modbus information from a
slave module. You must disable Standard security to write data to a slave module. See the ION System
Security technical note for more information.
Page 5
Ethernet
Modbus/TCP
Modbus
slave
YoucanalsomakeaserialconnectiontoanIONmeterusingthirdpartysoftware.
Setthecommunicationportonthemeterusingthefrontpanelofthemeter.
Third-party software acting
as a Modbus Master
RS -4
85
Modbus
slaves
Page 6
Setting the serial communication from the ION meter to third-party software
1.
Usingthefrontpanelofthemeter,navigatetothecommunicationsportyou
wanttousetoconnecttothirdpartysoftware.
2.
SettheprotocolforthisporttoModbusRTUandensurethebaudrate,unit
ID,serialportandRS232orRS485settingsarecorrect.
UseIONSetuporIONEnterprisesoftwaretomodifythesesettingsformeters
withoutafrontpaneldisplay.
Modbus/TCP
UsetheIONEnterpriseModbusDeviceImporterutilitytoconfigureyourModbus
device(mappinginformation)andadditasaDeviceTypetotheNetwork
Configurationdatabase.
NOTE
See the online ION Enterprise Help for more information on adding Modbus device types to
ION Enterprise. You can also contact Technical Support about pre-made Device Integration Packages,
which add a device directly into your system.
Oncethedevicetypeisadded,youcanseeyourModbusdeviceinadropdown
menuinManagementConsole.
Adding a Modbus device to the ION Enterprise network
1.
StartManagementConsole.ClicktheDevicesiconontheSystemSetuppane.
2.
RightclickinthedisplaywindowandselectNew>SerialDeviceonDirect
Site,New>SerialDeviceonEthernetGatewaySiteorNew>EthernetDevice,
dependingonyourtypeofconnection.TheDeviceConfigurationdialogbox
appears.
3.
Usethedropdownmenusortypetherequiredinformationinthefields.Your
ModbusdevicetypeappearsintheDeviceTypedropdownmenu.
Page 7
NOTE
Most Modbus Master-enabled meters support only one serial bus of Modbus Slave devices. However,
some meters offer multiple Modbus Master serial port functionality. See Multiport Serial Modbus Master
on page 15 for more information.
TheTCP/IPlinkcanconnectuptotendevicestotheModbusMaster.The
connectionsarecreatedbyenteringtheIPaddressofthedeviceyouwantto
connecttoandtheportnumber(ModbusTCP/IPisport502).
BetweentheIONmeterandIONSetuporIONEnterprisesoftwareFor
Ethernetcommunications,themeterallowsmultipleTCP/IPvirtualports(i.e
502,7701,etc.)toconnecttoasinglehardwareport.Onthemeter,TCP/IPvirtual
portsindicatetothesoftwarewhichprotocolisbeingusedtocommunicate.
Usingthefrontpanelofthemeter,navigatetotheserialcommunicationsport
youwanttousetoconnecttotheModbusSlavedevices.
2.
SettheprotocolforthisporttoModbusMasterandensurethebaudrate,unit
ID,serialportandRS232orRS485settingsareappropriate.
UseIONSetuporIONEnterprisesoftwaretomodifythesesettingsformeters
withoutafrontpaneldisplay.
Page 8
TheimagebelowshowshowIONSetuporIONEnterprisesoftwareandanION
meter(communicatingoverEthernet)canintegratewithaserialModbusnetwork.
ION meter as
Modbus Master
ION Enterprise
software
ION6200
ION7550
192.168.0.1:502
ION meter as
Modbus Master
Ethernet
Ethernet
Up to 10 unique IP
addresses can be entered
for Modbus Master
Page 9
Ports
7700 (ION)
7701 (Modbus RTU)
7801 (EtherGate COM1)
7802 (EtherGate COM2 or COM4)
TheEtherGatemeteractsasanintermediarybetweentheRS485devices(Modbus
slaves)andtheModbusmaster,allowingtheModbusmastertosendandreceive
dataoverTCP/IP.InIONEnterprise,userscancreateanEtherGatesiteand
communicatewithaseriesofdevicesontheRS485loop.
FormoreinformationonEtherGateandIONmeters,seeTheIONMeterasan
EthernetGatewaytechnicalnote.
Ethernet
(Modbus/TCP)
RS-485 loop
(Modbus RTU)
Workstations running Modbus
Master software send out a
Modbus request packet.
Downstream
Modbus serial
devices
TheModbusGatewaymeteractsasanintermediarybetweenModbusslavesona
serialnetworkandtheModbusmasterdevice,allowingdatatobesentand
receivedoverModbus/TCP.
FormoreinformationonusingyourIONmeterasaModbusGateway,seeyour
metersUserGuide.
Page 10
NOTE
Only one meter on a Modbus network can have the communications channel set to the Modbus Master
protocol.
NOTE
There are many Modbus Import, Modbus Export and Modbus Master Device modules available. The
modules behave like Modbus controllers. However, each module can only communicate to a single
Modbus slave device on a single communication connection.
Page 11
Reading Data from Modbus devices using the Modbus Master Device Module
1.
StartDesigner(ensurethatOptions>ShowToolboxischecked).
2.
NavigatetotheModbusMasterOptionsmodule.Rightclickthemoduletoedit
theregistervalues.
ForserialModbusMaster,configuretheSerialConnectionvaluestomatch
thecommunicationsport(e.g.,COM2,COM3)beingusedtocommunicate
withtheModbusslavedevices.
ForModbusMasteroverTCP/IP,configuretheTCPConnectionvaluesto
matchtheIPaddressoftheslavedeviceandtheport
(e.g.,192.168.0.1:502).
Register Name
Register Type
3.
NavigatetowhereyouwanttostoreyourModbusMasterconfiguration(e.g.,
3rdPartyProtocols>Modbus).Dragoutanewgroupingobjectfromthe
toolbox,nameitappropriatelyanddoubleclickonyournewgroupingobject.A
blankworkspacedisplayswhereyoucankeepyourModbusMaster
configuration.
4.
DragoutanewModbusMasterDevicemoduletousewithyourModbusslave
device.Rightclickthemoduleandconfigurethefollowingregisters:
Description
Notes
Enable
Boolean Input
Read Now
Pulse Input
Connection
Enumerated
Setup
Slave Addr
Numeric Setup
Device Type
String Setup
Slave Name
String Setup
Enter the name of the Modbus slave device -for example, Submeter1.
Outputs 1-32
Numeric Output
Page 12
5.
Register Name
Register Type
DragoutanewModbusMasterMapmodule.Rightclickthemoduleand
configurethefollowingregisters:
Description
Notes
Device Type
String Setup
Device Map
String Setup
6.
Linktheoutputregisterstodesiredmodules(suchasDataRecorders).The
outputvaluesfromtheModbusMasterDevicemoduleareappendedwitha
labelanddevicename.TheDataRecordermoduleunderstandsthesenames,
andwillpopulatetheIONdatabaseusingthem(e.g.kW@Submeter1).
7.
InVista,updateyouruserdiagrambydragginganewobjectfromtheDiagram
objectstoolbar,andconfigureittobestdisplayyourModbusslavedevicedata.
Reading Data from Modbus devices using the Modbus Import Module
1.
StartDesigner(ensurethatOptions>ShowToolboxischecked).
2.
NavigatetotheModbusMasterOptionsmodule.Rightclickthemoduletoedit
theregistervalues.
ForserialModbusMasterconfiguretheSerialConnectionvaluestomatch
thecommunicationsport(e.g.,COM2,COM3)beingusedtocommunicate
withtheslavedevices.
ForModbusMasteroverTCP/IP,configuretheTCPConnectionvaluesto
matchtheIPaddressoftheslavedeviceandtheport
(e.g.,192.168.0.1:502).
3.
NavigatetowhereyouwanttostoreyourModbusMasterconfiguration(e.g.,
3rdPartyProtocols>Modbus).Dragoutanewgroupingobjectfromthe
toolbox,nameitappropriatelyanddoubleclickonyournewgroupingobject.A
blankworkspacedisplayswhereyoucankeepyourmasterconfiguration.
4.
DragoutaModbusImportmodule.
5.
UsetheReadNowinputoftheModbusImportmoduleifyouwanttosetupa
triggersourcethatactivatesaread(i.e.apulse).IfyoudonotlinkReadNow,the
modulepollsModbusdevicescontinuously.
6.
RightclicktheModbusImportmoduletoconfigureregistersettings.
Configurethefollowingsetupregistersasneeded:Connection/COMMPort(if
applicable),SlaveAddress,RegisterAddress,NumberofRegistersreadbythe
module,Formatandscalingrequirements.ThesupportedSlaveAddressrange
(UnitIDonIONmeters)foraModbusdeviceisfrom1to247.
7.
Linktheoutputregisterstodesiredmodules(suchasDataRecorders).
8.
InVista,updateyouruserdiagrambydragginganewobjectfromtheDiagram
objectstoolbar,andconfigureittobestdisplayyourModbusslavedevicedata.
Page 13
StartDesigner(ensurethatOptions>ShowToolboxischecked).
2.
NavigatetotheModbusMasterOptionsmodule.Rightclickthemoduletoedit
theregistervalues.
ForserialModbusMaster,configuretheSerialConnectionvaluestomatch
thecommunicationsport(e.g.,COM2,COM3).
ForModbusMasteroverTCP/IP,configuretheTCPConnectionvaluesto
equaltheIPaddressoftheslavedeviceandtheport
(e.g.,192.168.0.1:502).
3.
NavigatetowhereyouwanttostoreyourModbusMasterconfiguration(e.g.,
3rdPartyProtocols>Modbus).Dragoutanewgroupingobjectfromthe
toolbox,nameitappropriatelyanddoubleclickonyournewgroupingobject.A
blankworkspacedisplayswhereyoucankeepyourmasterconfiguration.
4.
DragoutaModbusExportmodule.
5.
LinktheSourceinputsoftheExportmoduletovaluesthatyouwanttoexport.
6.
YoumustlinkWriteNowtoinitiateawrite.
7.
RightclickontheModbusExportmoduletoconfigurethesetupregister
settings.
SettheConnection/COMMPort(ifapplicable),SlaveAddress,RegisterAddress,
RequestType,andFormatregistersandanyscalingrequirements.ASlaveAddress
ofzero(0)isreservedforbroadcastmessages.Broadcastmessagesareusefulfor
controlactions,suchassynchronizingallthedevices(onlyanapproximate
synchronizationispossibleduetosignallatencies).
TIP
Use Designer to determine the ION module/register that you want to write to and then use the Common
Modbus Registers document and Appendix E of the ION7300 Series Modicon Modbus Serial
Communications Protocol document to find the corresponding Modbus register number.
For protocols other than ION, consult the appropriate protocol documentation for your device.
8.
InVista,createandlinkanobjectthatbestdisplaysyourconfiguration.
OpenIONSetupandconnecttoyourmeterinBasicMode.
2.
OpentheSetupAssistantandnavigatetothe3rdPartyProtocolsscreeninthe
Communicationsfolder.
3.
OntheModbusMastertab,clickAddtoaddanewslavedevice.TheModbus
Devicedialogappears.
4.
Entertheinformationrequested:
Name:Thisistheslavedevicename
Labelsuffix:Thisistheslavedevicegroup.
Devicetype:Thisisthedevicetypeoftheslavedevice.Itmustmatchthe
devicetypegivenintheDeviceTyperegisterintheModbusMasterMap
module.
Page 14
Connectionvia:ThisistheserialconnectionorEthernetTCPconnections
throughwhichyoucommunicatewiththeslavedevice.Toviewtheports/IP
addressesandModbusprotocolassignedtoeachconnection,click
Connections.TheModbusMasterConnectionsscreenappearswithtabs
containingconnectioninformation.
SlaveID:ThisistheslaveID,orslaveaddress,thatthemeterusesto
addresspacketstotheslavedevice.
5.
Toperformmoreadvancedconfiguration,connecttoyourmeterinAdvanced
Modeandnavigatetotherelevantfolder.Toinsertanewmodule,selectInsert
>Module.Toeditmodulesettings,doubleclickonthemoduleintherighthand
pane.
ThemodulesrelevanttoModbusMasterare:ModbusMasterDevicemodule,
ModbusMasterMapmodule,ModbusMasterOptionsmodule,Modbus
ImportmoduleandModbusExportmodule.Formoreinformationonthese
modules,seetheIONReference.
NOTE
The ION7550 RTU does not support multiport Modbus Master. The device cannot master on serial
communication ports COM1 and COM2 at the same time.
MultiportserialModbusMasterfunctionalityrequiresconfigurationofaspecial
module(ModbusMasterOptions)andadditionalsetupregistersinthreeother
modules(ModbusImport,ModbusExport,andModbusMasterDevice).
SeetheIONReferenceformoreinformationonthesemodules.
Workstation with
Modbus Software
ION meter as
Modbus Master
Ethernet LAN
Page 15
InorderfortheMastertoknowonwhichserialbusadeviceresides,theModbus
MasterOptionsmoduleisusedtomap(orlink)aconnectiontoameterserial
communicationport.Allmodulesfortheslavedevices(ModbusImport,Export
andModbusMasterDevice)arethenmappedtooneoftheconnections.
TheModbusMasterOptionsmodulesfouroutputsindicateifeachserial
connectionisactivelybeingusedbyanotherIONmodule(ModbusImport,Export
andModbusMasterDevice).
Seetheexampleframeworkbelowforimplementationdetails.TheION7650
meter,actingasModbusMaster,iscommunicatingwiththeION7330,actingas
ModbusSlave.TheION7330iswiredviaRS485totheION7650metersCOM2
port.TheION7330metersUnitIDis101.
Modbus Master Device
ION7650 Meter
COM2 is set to
Modbus Master
ION7330
Modbus Import
Module
Modbus Master
Options Module
RS-485
UNIT ID = 101
Connection
Serial Connection 2
Serial Connection 2
Slave Addr
COM2
COM2
101
Page 16
Page 17
NOTE
A Modbus slave can only respond to requests; it cannot initiate them.
MostIONmetershavepreconfiguredModbusSlavemodules.Thesecanbe
accessedusingDesigner,insidetheIONmeters3rdPartyProtocolsfolder.If
thesepreconfiguredmodulesdonotsuityourneeds,youcandragoutnew
ModbusSlavemodulesorchangetheconfigurationoftheexistingones.
Communications Port
Power Meter
Module
Vln a
Modbus Slave
Module
40011
Data is available
to Modbus master
devices
IONmeter
Page 18
OnsomeIONmeters,whentherearenoinputlinks,theoutputregistersshowthe
contentsofthefixedModbusaddressmapasdefinedbythesetupregistersofthe
SlaveModule.Thevaluesatthemapaddressarecopiedtotheoutputregisters,
startingattheaddressspecifiedintheBaseAddrsetupregister,untileachoutput
registerisfilled.YoumustchangetheFormatsetupregistertoUnsigned16B
InputMode.
YoucanalsoeditthesetupregistersoftheSlavemoduleifyourModbusmaster
devicerequiresdatainaformatdifferentthanthefactoryconfigurationorrequires
specialaddressing.ModbusSlavemoduleshavethefollowingsetupregisters:
Setup Register
Format
Base Address
Scaling
IONInMinScale
IONInMaxScale
ModbusOutMinScale
ModbusOutMaxScale
NOTE
Settings for these registers (and defaults) vary depending on meter model and firmware version. See your
meters User Guide.
FormoreinformationonusingtheModbusSlavemodule,seetheModbusSlave
moduledescriptionintheIONReference.
Changing default Modbus configuration using ION Enterprise
1.
OpenyourmeterinDesigner.
2.
RelinkaneworexistingModbusSlavemoduletoanyparameters.
3.
Rightclicknearthecenterofthemoduletoeditanyoftheregisters.
4.
SelectFile>Send&Savetosaveyourchangestothemeter.
1.
OpenIONSetupandconnecttoyourmeterinAdvancedMode.
2.
NavigatetotheModbusSlavemodulefolder.Intherighthandpane,double
clickonthemoduleyouwanttoconfigure.
3.
SelecttheInputstabtolinksourceinputstothemodule.SelecttheSetup
Registerstabtoconfigurethesetupregisters.Toeditaregister,selectitandclick
Edit.
4.
ClickSendtosaveyourchangestothemeter.
Page 19