+ All Categories
Home > Documents > Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... ·...

Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... ·...

Date post: 07-Feb-2018
Category:
Upload: truongngoc
View: 240 times
Download: 8 times
Share this document with a friend
21
Modbus Overview Hans-Petter Halvorsen, M.Sc.
Transcript
Page 1: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

ModbusOverview

Hans-PetterHalvorsen,M.Sc.

Page 2: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

WhatisModbus?• Modbusisaserialcommunicationsprotocoloriginally

publishedbyModicon (nowSchneiderElectric)in1979forusewithitsprogrammablelogiccontrollers(PLCs).

• Simpleandrobust,ithassincebecomeadefactostandardcommunicationprotocol,anditisnowacommonlyavailablemeansofconnectingindustrialelectronicdevices

• ThedevelopmentandupdateofModbusprotocolshasbeenmanagedbytheModbusOrganizationsinceApril2004,whenSchneiderElectrictransferredrightstothatorganization

• Modbusbecamethefirstwidelyacceptedfieldbusstandard.

https://en.wikipedia.org/wiki/Modbus

Page 3: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

Master/Slave• Modbusprotocolisdefinedasamaster/slaveprotocol,meaningadeviceoperatingasamasterwillpolloneormoredevicesoperatingasaslave.

• Thismeansaslavedevicecannotvolunteerinformation;itmustwaittobeaskedforit.

• Themasterwillwritedatatoaslavedevice’sregisters,andreaddatafromaslavedevice’sregisters.Aregisteraddressorregisterreferenceisalwaysinthecontextoftheslave’sregisters.

Page 4: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

Master/Slave

MasterSlave

Master DataStoredinRegisters

WriteData

ReadData

Modbusprotocolisdefinedasamaster/slaveprotocol,meaningadeviceoperatingasamasterwillpolloneormoredevicesoperatingasaslave.Thismeansaslavedevicecannotvolunteerinformation;itmustwaittobeaskedforit.Themasterwillwritedatatoaslavedevice’sregisters,andreaddatafromaslavedevice’sregisters.Aregisteraddressorregisterreferenceisalwaysinthecontextoftheslave’sregisters.

Polling/Request

Registers

Page 5: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

ModbusRegisterTypes• Coil(DiscreteOutput)– Coilsare1-bitregisters,usedtocontroldiscreteoutputs,ReadorWrite

• DiscreteInput– 1-bitregisters

• InputRegister• HoldingRegister

16-bit data registers

Page 6: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

RegisterAddresses

0x=Coil,AddressRange:00001-099991x=DiscreteInput,AddressRange: 10001-199993x=InputRegister,AddressRange:30001-399994x=HoldingRegister,AddressRange: 40001-49999Whenusing theextendedreferencing,allnumber referencesmustbeexactlysixdigits.Thisavoidsconfusionbetweencoilsandotherentities.Forexample,toknowthedifferencebetweenholding register#40001andcoil#40001,ifcoil#40001isthetarget,itmustappearas#040001.

Page 7: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

RegisterReferencing40001:7• Thisisacommonlyusednotationforreferencingindividualbitsinaregister.

• Thisparticularexamplereferencesregister40001(whichisaHoldingRegister),bit7.

• Bitsaregenerallynumberedstartingatbit0,whichistheleastsignificantorrightmostbitinthefieldof16bitsfoundinaModbusregister.

Page 8: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

ModbusProtocols• ModbusASCII• ModbusRTU(RemoteTerminalUnit)– ModbusRTUusesRS-485orRS-232

• ModbusTCP/IP– ModbusTCPusesEthernet

ModbusASCIIandModbusRTUaresimpleserialprotocolsthatuseRS-232orRS-485totransmitdatapackets.ModbusTCP/IPfollowstheOSINetworkModelandcanbeusedinanordinaryEthernetnetwork

Page 9: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

ModbusASCII• ASCIIcharactersforprotocolcommunication

Page 10: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

ModbusRTU• Binaryrepresentationofthedataforprotocolcommunication.

• ModbusRTUusesRS-485orRS-232• ModbusRTUrequiresthatyouknowordefinebaudrate,characterformat(8bitsnoparity,etc.),andslaveID(akaslaveaddress,unitnumber,unitID).Amismatchinanyofthesewillresultinnocommunication.

Page 11: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

ModbusTCP/IP• ModbusTCP/IPfollowstheOSINetworkModelandcanbeusedinanordinaryEthernetnetwork

• ModbusTCPrequiresthatyouknowordefineIPaddressesonthenetwork

• ModbusTCP/IPusesPort502• InModbusTCP/IPweusethetermServer/ClientinsteadofSlave/Master– Slave->Server– Master->Client

Page 12: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

ModbusinLabvIEW

Hans-PetterHalvorsen,M.Sc.

Page 13: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

ModbusinLabVIEW3waystouseModbusinLabVIEW:• Useahigh-levelOPCServer• UseModbusI/OServer• UsetheLabVIEWModbusAPI

Introduction toModbus (NationalInstruments):http://www.ni.com/white-paper/7675/en/

“LabVIEWReal-TimeModule”or“LabVIEWDSCModule” required

Page 14: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

LabVIEWModbusAPI

Page 15: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

LabVIEWExample

Master(Client) Slave

(Server)

Master(Client) DataStoredinRegisters

WriteData

ReadData

Polling/Request

Registers

LabVIEWApp#1LabVIEWApp#2

LabVIEWApp#3

InthisExampleweCreate3differentLabVIEWApplications

Page 16: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

LabVIEWExample

LabVIEWApp#1(Slave)

LabVIEWApp#2(Master)

LabVIEWApp#3(Master)

Note!Youneedtostart/runtheModbus SlaveAppbeforeyoustarttheModbusMasterApps

WriteDatatoSlave

ReadDatafromSlave

Page 17: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

ModbusSlave

Page 18: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

ModbusMaster(Write)

Page 19: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

ModbusMaster(Read)

Page 20: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

References• ModbusOrganization:http://www.modbus.org• Modbus(Wikipedia):https://en.wikipedia.org/wiki/Modbus• IntroductiontoModbus(NationalInstruments):

http://www.ni.com/white-paper/7675/en/• Modbus101- IntroductiontoModbus:

http://www.csimn.com/CSI_pages/Modbus101.html• ModbusTCP/IP:

http://www.rtaautomation.com/technologies/modbus-tcpip/• ModbusRTU:

http://www.rtaautomation.com/technologies/modbus-rtu/

Page 21: Modbus Overview - hit.Nohome.hit.no/~hansha/documents/industrial_it/resources/resources... · Modbus Overview Hans-Petter Halvorsen, M.Sc. What is Modbus? ... Modbus in LabVIEW 3

Hans-PetterHalvorsen,M.Sc.

UniversityCollegeofSoutheastNorwaywww.usn.no

E-mail:[email protected]:http://home.hit.no/~hansha/


Recommended