CN104698962B - PLC man-machine communication's method and system - Google Patents

PLC man-machine communication's method and system Download PDF

Info

Publication number
CN104698962B
CN104698962B CN201510070349.7A CN201510070349A CN104698962B CN 104698962 B CN104698962 B CN 104698962B CN 201510070349 A CN201510070349 A CN 201510070349A CN 104698962 B CN104698962 B CN 104698962B
Authority
CN
China
Prior art keywords
plc
man
machine interface
internal register
mark
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510070349.7A
Other languages
Chinese (zh)
Other versions
CN104698962A (en
Inventor
樊文宏
池家武
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
KINCO AUTOMATION (SHANGHAI) Ltd
Original Assignee
KINCO AUTOMATION (SHANGHAI) Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by KINCO AUTOMATION (SHANGHAI) Ltd filed Critical KINCO AUTOMATION (SHANGHAI) Ltd
Priority to CN201510070349.7A priority Critical patent/CN104698962B/en
Publication of CN104698962A publication Critical patent/CN104698962A/en
Application granted granted Critical
Publication of CN104698962B publication Critical patent/CN104698962B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/05Programmable logic controllers, e.g. simulating logic interconnections of signals according to ladder diagrams or function charts
    • G05B19/054Input/output
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/10Plc systems
    • G05B2219/11Plc I-O input output
    • G05B2219/1153Scan only some I-O registers, use flags
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/10Plc systems
    • G05B2219/16Plc to applications
    • G05B2219/163Domotique, domestic, home control, automation, smart, intelligent house

Abstract

The present invention relates to PLC man-machine communication's method and system.The present invention establishes corresponding protocol definition file in host computer according to different PLC communication protocol types, and defines communications parameter.Protocol definition file includes the title and mark ID, corresponding PLC master slave mode and communication driver of corresponding PLC communications protocol.The PLC that user needs to communicate by man-machine interface upper computer selecting, the mark ID, protocol definition file and communications parameter of corresponding PLC communications protocol are sent to man-machine interface slave computer by man-machine interface host computer, man-machine interface slave computer can determine to need the PLC communicated according to the mark ID received, and the protocol definition file according to corresponding to mark ID determines the master slave mode of the PLC, is then communicated according to PLC master slave mode by different modes and PLC.The present invention defines man-machine interface and PLC communications protocol by unified communications protocol form, and man-machine interface can be made to adapt to different types of PLC communications protocol, convenient to be communicated with different types of PLC.

Description

PLC man-machine communication's method and system
Technical field
The present invention relates to industrial automation communication field man-machine interface, more particularly to a kind of PLC man-machine communications method and it is System.
Background technology
There is the customized agreement communicated with PLC in man-machine interface producer in the market, still, due to PLC The diversity of communications protocol, to needing progress different-format to determine when associated communication agreement is defined corresponding to smart machine end Justice could meet the definition demand of relevant parameter, cause communications protocol complex designing in software development process.It is simultaneously as existing Communications protocol parameter setting file often handled using binary file, make communications protocol modification and safeguard lack facility Property.Again, the diversity of the PLC internal register addresses forms of different PLC producers also causes many communications protocol comprehensive Access all register informations.
The content of the invention
The technical problem to be solved by the invention is to provide a kind of PLC man-machine communications method and system, are led to by unified Interrogate protocol format, compatible different PLC communications protocol.What the present invention was realized in:
A kind of PLC man-machine communications method, comprises the following steps:
Step A:The mark ID of the PLC communications protocol that man-machine interface host computer selects user, protocol definition file and logical News parameter is sent to man-machine interface slave computer;
The protocol definition file and communications parameter of each PLC communications protocol are prestored in the man-machine interface host computer;It is described Protocol definition file includes the title and mark ID of corresponding PLC communications protocol, corresponding PLC master slave mode and communication driving journey Sequence;When PLC is as communication slave station, the protocol definition file also includes the mark ID of each internal register, word length in the PLC Parameter, address realm, read-write mode and display Name;
Step B:Man-machine interface slave computer determines to need the PLC communicated according to the mark ID that receives, and according to the mark Know the master slave mode that protocol definition file corresponding to ID judges the PLC that needs communicate;
Step C:The master slave mode for the PLC that man-machine interface slave computer communicates as needed is communicated with the PLC;
When the PLC for needing to communicate is as communication main website, the step C includes:
Man-machine interface slave computer opens the power down not save register, and pass through ID pairs of the mark with receiving of man-machine interface The communication driver of the PLC in the protocol definition file answered is communicated with the PLC;PLC can be according to corresponding communications parameter Established with man-machine interface and connect and access the power down not save register;
When the PLC for needing to communicate is as communication slave station, the step C includes:
Man-machine interface slave computer receives the mark for the internal register for needing to access in the PLC that man-machine interface host computer is sent Know ID, and the read-write mode of the internal register is obtained according to the mark ID of the internal register received, and according to the read-write Mode parses the actual address deviant of the internal register;
The mark ID of the internal register received and actual address deviant are sent to the PLC by man-machine interface slave computer Communication driver, to call the communication driver, and communicated according to corresponding communications parameter and the PLC.
Further, the integer-bit system of the read-write mode of internal register including the internal register, from decimal place to The system and decimal place system of integer-bit carry;The step of actual address deviant for parsing internal register, includes:
According to the integer-bit system of internal register and decimal place system by the integer figure of the internal register according to and it is small Digit data is converted to the decimal system;
If m is to be converted to the integer figure evidence after the decimal system, n is to be converted to the decimal digits evidence after the decimal system, and y is interior for this The actual address deviant of portion's register, then y=m × 2x+ n, wherein, x is the hex value from decimal place to integer-bit carry.
Further, the read-write mode of internal register also includes the addressing mode of the internal register;When needing to access During PLC multiple internal registers, it is interior that man-machine interface slave computer always according to the mark ID of the internal register received obtains this The word length parameter and addressing mode of portion's register;
The man-machine interface slave computer is on parsing after the actual address deviant of an internal register, according to described Word length parameter and addressing mode calculate the actual address deviant of next internal register, and are calculated accordingly inside other The actual address deviant of register.
Further, methods described also comprises the following steps:When the actual address deviant being calculated is beyond described During the scope of location, man-machine interface slave computer sends corresponding prompting.
Further, the edit format of the protocol definition file is XML, coded system UTF-8.
A kind of PLC man-machine communications system, is communicated for PLC and man-machine interface, including man-machine interface host computer and people Machine interface slave computer;
The man-machine interface host computer be used for by the mark ID of PLC communications protocol of user's selection, protocol definition file and Communications parameter is sent to man-machine interface slave computer;
The protocol definition file and communications parameter of each PLC communications protocol are prestored in the man-machine interface host computer;It is described Protocol definition file includes the title and mark ID of corresponding PLC communications protocol, corresponding PLC master slave mode and communication driving journey Sequence;When PLC is as communication slave station, the protocol definition file also includes the mark ID of each internal register, word length in the PLC Parameter, address realm, read-write mode and display Name;
Man-machine interface slave computer is additionally operable to determine PLC that needs communicate according to the mark ID that receives, meanwhile, according to this Protocol definition file corresponding to mark ID judges the master slave mode for the PLC that needs communicate, and the PLC communicated as needed principal and subordinate Pattern is communicated with the PLC;
When the PLC for needing to communicate is as communication main website, the power down that man-machine interface slave computer opens man-machine interface does not preserve Register, and pass through the communication driver and the PLC of the PLC in the corresponding protocol definition file of mark ID with receiving Communicated;PLC can be established according to corresponding communications parameter and man-machine interface and be connected and access the power down not save register;
When the PLC for needing to communicate is as communication slave station, man-machine interface slave computer receives what man-machine interface host computer was sent The mark ID of internal register accessed is needed in the PLC, and it is interior according to the mark ID of the internal register received to obtain this The read-write mode of portion's register, meanwhile, the actual address deviant of the internal register is parsed according to the read-write mode, and will connect The mark ID and actual address deviant of the internal register received are sent to the communication driver of the PLC, to call this logical Driver is interrogated, and is communicated according to corresponding communications parameter and the PLC.
Further, the integer-bit system of the read-write mode of internal register including the internal register, from decimal place to The system and decimal place system of integer-bit carry;Man-machine interface slave computer is according to the integer-bit system and decimal place of internal register The integer figure evidence of the internal register and decimal digits evidence are converted to the decimal system by system;And it is interior according to equation below to parse this The actual address deviant of portion's register:
If m is to be converted to the integer figure evidence after the decimal system, n is to be converted to the decimal digits evidence after the decimal system, and y is interior for this The actual address deviant of portion's register, then y=m × 2x+ n, wherein, x is the hex value from decimal place to integer-bit carry.
Further, the read-write mode of internal register also includes the addressing mode of the internal register;When needing to access During PLC multiple internal registers, it is interior that man-machine interface slave computer always according to the mark ID of the internal register received obtains this The word length parameter and addressing mode of portion's register;
The man-machine interface slave computer is on parsing after the actual address deviant of an internal register, according to described Word length parameter and addressing mode calculate the actual address deviant of next internal register, and are calculated accordingly inside other The actual address deviant of register.
Further, when the actual address deviant being calculated exceeds the address realm, man-machine interface slave computer Send corresponding prompting.
Further, the edit format of the protocol definition file is XML, coded system UTF-8.
The present invention establishes corresponding protocol definition file in host computer according to different PLC communication protocol types, and fixed Adopted communications parameter.Protocol definition file includes the title and mark ID, corresponding PLC master slave mode of corresponding PLC communications protocol And communication driver.The PLC that user needs to communicate by man-machine interface upper computer selecting, man-machine interface host computer will be corresponding Mark ID, protocol definition file and the communications parameter of PLC communications protocol are sent to man-machine interface slave computer, man-machine interface slave computer It can be determined to need the PLC communicated according to the mark ID received, and the protocol definition file according to corresponding to mark ID is true Fixed PLC master slave mode, is then communicated according to PLC master slave mode by different modes and PLC.The present invention passes through system One communications protocol form defines man-machine interface and PLC communications protocol, and man-machine interface can be made to adapt to different types of PLC communications Agreement, it is convenient to be communicated with different types of PLC.
Brief description of the drawings
Fig. 1:The definition method flow schematic diagram of man-machine interface of the present invention and PLC communications protocol;
Fig. 2:The definition system composition schematic diagram of man-machine interface of the present invention and PLC communications protocol.
Fig. 3:Man-machine interface of the present invention and the composition schematic diagram of register definitions module 5 in the definition system of PLC communications protocol;
Fig. 4:The composition schematic diagram of register read-write mode setting module 55 in register definitions module 5.
Fig. 5:PLC man-machine communications system composition schematic diagram of the present invention;
Fig. 6:PLC man-machine communications method flow schematic diagram of the present invention.
Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, it is right below in conjunction with drawings and Examples The present invention is further elaborated.
The present invention mainly defines man-machine interface and PLC (programmable logic controller (PLC)) by using unified protocol format Between communications protocol, make the compatible different PLC communications protocol of man-machine interface, it is convenient to communicated with various PLC. As shown in figure 1, before PLC man-machine communication's methods using the present invention, need to first predefine and PLC communications protocol, definition method Comprise the following steps:
Firstly, it is necessary to the protocol definition file according to corresponding to being established PLC communications protocol title.Protocol definition file name Can be of the same name with communications protocol, using XML edit format and UTF-8 coded system.Secondly, it is also necessary to distributed for communications protocol First uniqueness ID, to identify communications protocol.It is also desirable to set the type of communications protocol, and assisted according to type for communication View setting communications parameter.The type of communications protocol includes network communication protocol, serial port communicating protocol and bus protocol etc., root The hardware connection mode between man-machine interface and PLC can be specified according to the type of communications protocol, and sets the silent of communications protocol accordingly Recognize communications parameter.If PLC does communication main website, just completed to this and man-machine interface and the PLC communications protocol are determined Justice, if PLC does communication slave station, on the basis of abovementioned steps are completed, also need to complete the internal register to the PLC Definition, just calculate the definition completed to man-machine interface and the PLC communications protocol.The step of internal register for defining PLC, includes:
Corresponding display Name in man-machine interface is set according to PLC internal register title, display Name can be with inside Register is of the same name.The second uniqueness ID is distributed for register in communications protocol, with marker register.According to the reality of register Word length sets corresponding word length parameter.Corresponding address realm is set according to the access profile of register.Set the reading of register WriteMode.It is noted that the register of all open read-writes in PLC can only be defined.The definition register the step of In, the setting procedure of the read-write mode of register includes:
The addressing mode of definition register.The value of addressing mode is generally Bi t, Byte, Word, DWord, corresponds to respectively Position, byte, word and double word, and AddressWidth (address width) attribute are used cooperatively, and are mainly used to definition register skew The interval (length/Mode of the interval equal to AddressWidth length) of value.Illustrate:Assuming that register X AddressWidth attributes and Mode attributes are all Bit, then at intervals of 1, register X access mode is X0, X1, X2;Assuming that Register Y AddressWidth attributes are Word, and Mode (pattern) attribute is Byte, then at intervals of Word/Byte=2, i.e., 1 Individual Word length is equal to 2 Byte length, so the access mode of register is Y0, Y2, Y4;Assuming that register Z AddressWidth attributes are DWord, and Mode attributes are Byte, then at intervals of DWord/Byte=4, i.e., 1 DWord length Equal to 4 Byte length, so the access mode of register is Z0, Z4, Z8.
Integer-bit system in definition register.The value of integer-bit system is generally Dec, Oct, Hex, corresponds to ten respectively and enters System, octal system and hexadecimal.
System in definition register from from decimal place to integer-bit carry.It is general from the system of decimal place to integer-bit carry Defined in the form of 2 n powers, value generally 0,3,4,8 etc., when value is 0, represent no decimal point;When value is 3, Represent data after decimal point enter be made as 23 powers, i.e. octal system, i.e. number range after decimal point be 0-7, whenever arrival 8 When, enter 1 to integer-bit;When value is 4, represent data after decimal point enter be made as 24 powers, i.e. hexadecimal, i.e., after decimal point Number range be 0-15, whenever reaching 16, enter 1 to integer-bit, the rest may be inferred.
Decimal place system in definition register.Decimal place system is worth to define the carry value of numerical value behind decimal point Generally None, Dec, Oct and Hex, nothing, the decimal system, octal system and hexadecimal are corresponded to respectively, wherein when decimal bit length is When 0, the value of decimal place system is None, indicates no decimal point.
Man-machine interface and PLC communications protocol are defined using method provided by the invention, no matter PLC why species Which kind of mode type, the addressing of its internal register use, and can realize man-machine interface and PLC data interaction.
After definition is better than the communications protocol with PLC, you can using PLC man-machine communications method provided by the invention on man-machine boundary Face is communicated with PLC.Based on the communications protocol defined, the present invention proposes a kind of PLC man-machine communications system, for PLC Communicated with man-machine interface.As shown in figure 5, the system includes man-machine interface host computer and man-machine interface slave computer.Man-machine boundary The protocol definition file and communications parameter of each PLC communications protocol are prestored in the host computer of face.Protocol definition file includes corresponding PLC The title of communications protocol and mark ID, corresponding PLC master slave mode and communication driver etc..These data can be passed through by user Man-machine interface host computer editor is simultaneously packaged into PKG files and is sent in man-machine interface slave computer, in case subsequent calls.Protocol definition The edit format of file uses XML, and coded system uses UTF-8.When PLC is as communication slave station, protocol definition file also wraps Include mark ID, word length parameter, address realm, read-write mode and display Name of each internal register in the PLC etc..
When man-machine interface and PLC are communicated, user selects to need the PLC communicated first.User is by selecting PLC Communications protocol selects to need the PLC communicated, and user select PLC communications protocol be according to the title of PLC communications protocol come Selection.Man-machine interface host computer can use PC, and corresponding software is installed in PC, and user can select to need by software The PLC of communication, and specific communications parameter is defined, the PLC that then software selects according to user finds corresponding protocol definition File, and protocol definition file, the mark ID of the protocol definition file and communications parameter are packaged into PKG files together and are issued to Man-machine interface slave computer.
After man-machine interface slave computer receives the mark ID of PLC communications protocol, needs are determined according to the mark ID received The PLC of communication, meanwhile, the master slave mode for the PLC for needing to communicate according to protocol definition file corresponding with mark ID judgement, and The PLC communicated as needed master slave mode is communicated with the PLC.Specifically include two kinds of situations:
First, when the PLC for needing to communicate is as communication main website, the power down that man-machine interface slave computer opens man-machine interface is not protected Deposit register, and by the communication driver of the PLC in the corresponding protocol definition file of mark ID with receiving with should PLC is communicated;PLC can be established according to corresponding communications parameter and man-machine interface and be connected and access the power down not save register.
2nd, when the PLC for needing to communicate is as communication slave station, man-machine interface slave computer receives man-machine interface host computer and sent The PLC in need the mark ID of internal register that accesses, and obtained according to the mark ID of the internal register received should The read-write mode of internal register, meanwhile, the actual address deviant of the internal register is parsed according to the read-write mode, and incite somebody to action The mark ID and actual address deviant of the internal register received are sent to the communication driver of the PLC, are somebody's turn to do with calling Communication driver, and communicated according to corresponding communications parameter and the PLC.
The integer-bit system of the read-write mode of internal register including the internal register, from decimal place to integer-bit carry System and decimal place system.When parsing the actual address deviant of the internal register, man-machine interface slave computer is according to inside The integer figure evidence of the internal register and decimal digits evidence are converted to ten by the integer-bit system and decimal place system of register System, and parse according to equation below the actual address deviant of the internal register:
If m is to be converted to the integer figure evidence after the decimal system, n is to be converted to the decimal digits evidence after the decimal system, and y is interior for this The actual address deviant of portion's register, then y=m × 2x+ n, wherein, x is the hex value from decimal place to integer-bit carry.
The read-write mode of internal register also includes the addressing mode of the internal register, when need access PLC it is multiple During internal register, man-machine interface slave computer obtains the internal register always according to the mark ID of the internal register received Word length parameter and addressing mode.Man-machine interface slave computer on parsing after the actual address deviant of an internal register, The actual address deviant of next internal register is calculated according to word length parameter and addressing mode, and other are calculated accordingly The actual address deviant of internal register.When the actual address deviant being calculated exceeds address realm, man-machine interface Slave computer will send corresponding prompting.
As shown in fig. 6, present invention also offers a kind of PLC man-machine communications method, comprise the following steps:
Step A:The mark ID of the PLC communications protocol that man-machine interface host computer selects user, protocol definition file and logical News parameter is sent to man-machine interface slave computer.The protocol definition file of each PLC communications protocol is prestored in man-machine interface host computer And communications parameter.The edit format of protocol definition file uses XML format, and coded system uses UTF-8.Protocol definition file bag Include the title and mark ID, corresponding PLC master slave mode and communication driver of corresponding PLC communications protocol.When PLC is as communication During slave station, protocol definition file also includes the mark ID of each internal register, word length parameter, address realm, read-write side in the PLC Formula and display Name.
Step B:Man-machine interface slave computer determines to need the PLC communicated according to the mark ID that receives, and according to the mark Know the master slave mode that protocol definition file corresponding to ID judges the PLC that needs communicate.
Step C:The master slave mode for the PLC that man-machine interface slave computer communicates as needed is communicated with the PLC.Including two Kind situation:
First, when the PLC for needing to communicate is as communication main website, step C includes:
Man-machine interface slave computer opens the power down not save register, and pass through ID pairs of the mark with receiving of man-machine interface The communication driver of the PLC in the protocol definition file answered is communicated with the PLC;PLC can be according to corresponding communications parameter Established with man-machine interface and connect and access the power down not save register.
2nd, when the PLC for needing to communicate is as communication slave station, step C includes:
Man-machine interface slave computer receives the mark for the internal register for needing to access in the PLC that man-machine interface host computer is sent Know ID, and the read-write mode of the internal register is obtained according to the mark ID of the internal register received, meanwhile, according to the reading WriteMode parses the actual address deviant of the internal register, and by the mark ID of the internal register received and practically Location deviant is sent to the communication driver of the PLC, to call the communication driver, and according to corresponding communications parameter with being somebody's turn to do PLC is communicated.
The integer-bit system of the read-write mode of internal register including the internal register, from decimal place to integer-bit carry System and decimal place system.When parsing the actual address deviant of internal register, man-machine interface slave computer is posted according to inside The integer figure evidence of the internal register and decimal digits evidence are converted to ten and entered by the integer-bit system and decimal place system of storage Make, and the actual address deviant of the internal register is parsed according to equation below:
If m is to be converted to the integer figure evidence after the decimal system, n is to be converted to the decimal digits evidence after the decimal system, and y is interior for this The actual address deviant of portion's register, then y=m × 2x+ n, wherein, x is the hex value from decimal place to integer-bit carry.
The read-write mode of internal register also includes the addressing mode of the internal register, when need access PLC it is multiple During internal register, man-machine interface slave computer obtains the internal register always according to the mark ID of the internal register received Word length parameter and addressing mode.Man-machine interface slave computer on parsing after the actual address deviant of an internal register, The actual address deviant of next internal register is calculated according to word length parameter and addressing mode, and other are calculated accordingly The actual address deviant of internal register.When the actual address deviant being calculated exceeds address realm, man-machine interface Slave computer will send corresponding prompting.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention All any modification, equivalent and improvement made within refreshing and principle etc., should be included in the scope of the protection.

Claims (10)

  1. A kind of 1. PLC man-machine communications method, it is characterised in that comprise the following steps:
    Step A:Mark ID, protocol definition file and the communication ginseng for the PLC communications protocol that man-machine interface host computer selects user Number is sent to man-machine interface slave computer;
    The protocol definition file and communications parameter of each PLC communications protocol are prestored in the man-machine interface host computer;The agreement Defining file includes the title and mark ID, corresponding PLC master slave mode and communication driver of corresponding PLC communications protocol;When When PLC is as communication slave station, the protocol definition file also include the mark ID of each internal register in the PLC, word length parameter, Address realm, read-write mode and display Name;
    Step B:The PLC that man-machine interface slave computer needs to communicate according to the mark ID of the PLC communications protocol received determinations, And the master slave mode for the PLC for needing to communicate according to protocol definition file corresponding with mark ID judgement;
    Step C:The master slave mode for the PLC that man-machine interface slave computer communicates as needed is communicated with the PLC;
    When the PLC for needing to communicate is as communication main website, the step C includes:
    Man-machine interface slave computer opens the power down not save register, and corresponding by the mark ID with receiving of man-machine interface The communication driver of the PLC in protocol definition file is communicated with the PLC;PLC can be according to corresponding communications parameter and people Machine interface, which is established, connects and accesses the power down not save register;
    When the PLC for needing to communicate is as communication slave station, the step C includes:
    Man-machine interface slave computer receives the mark for the internal register for needing to access in the PLC that man-machine interface host computer is sent ID, and the read-write mode of the internal register is obtained according to the mark ID of the internal register received, and according to the read-write side Formula parses the actual address deviant of the internal register;
    The mark ID and actual address deviant of the internal register received are sent to the logical of the PLC by man-machine interface slave computer Driver is interrogated, to call the communication driver, and is communicated according to corresponding communications parameter and the PLC.
  2. 2. PLC man-machine communications method as claimed in claim 1, it is characterised in that the read-write mode of internal register includes should The integer-bit system of internal register, from decimal place to the system of integer-bit carry and decimal place system;Parse internal register Actual address deviant the step of include:
    According to the integer-bit system of internal register and decimal place system by the integer figure of the internal register according to and decimal place Data are converted to the decimal system;
    If m is to be converted to the integer figure evidence after the decimal system, n is to be converted to the decimal digits evidence after the decimal system, and y is to be posted inside this The actual address deviant of storage, then y=m × 2x+ n, wherein, x is the hex value from decimal place to integer-bit carry.
  3. 3. PLC man-machine communications method as claimed in claim 2, it is characterised in that the read-write mode of internal register also includes The addressing mode of the internal register;When needing to access PLC multiple internal registers, man-machine interface slave computer is always according to connecing The mark ID of the internal register received obtains the word length parameter and addressing mode of the internal register;
    The man-machine interface slave computer is on parsing after the actual address deviant of an internal register, according to the word length Parameter and addressing mode calculate the actual address deviant of next internal register, and other internal deposits are calculated accordingly The actual address deviant of device.
  4. 4. PLC man-machine communications method as claimed in claim 2 or claim 3, it is characterised in that also comprise the following steps:When calculating When the actual address deviant gone out exceeds the address realm, man-machine interface slave computer sends corresponding prompting.
  5. 5. PLC man-machine communications method as claimed in claim 1, it is characterised in that the edit format of the protocol definition file For XML, coded system UTF-8.
  6. 6. a kind of PLC man-machine communications system, is communicated for PLC and man-machine interface, it is characterised in that including in man-machine interface Position machine and man-machine interface slave computer;
    The man-machine interface host computer is used for mark ID, protocol definition file and the communication of the PLC communications protocol of user's selection Parameter is sent to man-machine interface slave computer;
    The protocol definition file and communications parameter of each PLC communications protocol are prestored in the man-machine interface host computer;The agreement Defining file includes the title and mark ID, corresponding PLC master slave mode and communication driver of corresponding PLC communications protocol;When When PLC is as communication slave station, the protocol definition file also include the mark ID of each internal register in the PLC, word length parameter, Address realm, read-write mode and display Name;
    Man-machine interface slave computer is additionally operable to need the PLC communicated according to the mark ID determinations of the PLC communications protocol received, Meanwhile the master slave mode for the PLC for needing to communicate according to protocol definition file corresponding with mark ID judgement, and lead to as needed The PLC of news master slave mode is communicated with the PLC;
    When the PLC for needing to communicate is as communication main website, the power down that man-machine interface slave computer opens man-machine interface does not preserve deposit Device, and carried out by the communication driver of the PLC in the corresponding protocol definition file of mark ID with receiving with the PLC Communication;PLC can be established according to corresponding communications parameter and man-machine interface and be connected and access the power down not save register;
    When the PLC for needing to communicate is as communication slave station, man-machine interface slave computer receives the PLC that man-machine interface host computer is sent The mark ID of the middle internal register for needing to access, and inside deposit is obtained according to the mark ID of the internal register received The read-write mode of device, meanwhile, parse the actual address deviant of the internal register according to the read-write mode, and will receive The mark ID and actual address deviant of internal register are sent to the communication driver of the PLC, to call the communication to drive Program, and communicated according to corresponding communications parameter and the PLC.
  7. 7. PLC man-machine communications system as claimed in claim 6, it is characterised in that the read-write mode of internal register includes should The integer-bit system of internal register, from decimal place to the system of integer-bit carry and decimal place system;Man-machine interface slave computer According to the integer-bit system of internal register and decimal place system by the integer figure of the internal register according to and decimal digits evidence Be converted to the decimal system;And the actual address deviant of the internal register is parsed according to equation below:
    If m is to be converted to the integer figure evidence after the decimal system, n is to be converted to the decimal digits evidence after the decimal system, and y is to be posted inside this The actual address deviant of storage, then y=m × 2x+ n, wherein, x is the hex value from decimal place to integer-bit carry.
  8. 8. PLC man-machine communications system as claimed in claim 7, it is characterised in that the read-write mode of internal register also includes The addressing mode of the internal register;When needing to access PLC multiple internal registers, man-machine interface slave computer is always according to connecing The mark ID of the internal register received obtains the word length parameter and addressing mode of the internal register;
    The man-machine interface slave computer is on parsing after the actual address deviant of an internal register, according to the word length Parameter and addressing mode calculate the actual address deviant of next internal register, and other internal deposits are calculated accordingly The actual address deviant of device.
  9. 9. PLC man-machine communications system as claimed in claim 7 or 8, it is characterised in that when the actual address skew being calculated When value exceeds the address realm, man-machine interface slave computer sends corresponding prompting.
  10. 10. PLC man-machine communications system as claimed in claim 6, it is characterised in that the edit format of the protocol definition file For XML, coded system UTF-8.
CN201510070349.7A 2015-02-10 2015-02-10 PLC man-machine communication's method and system Active CN104698962B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510070349.7A CN104698962B (en) 2015-02-10 2015-02-10 PLC man-machine communication's method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510070349.7A CN104698962B (en) 2015-02-10 2015-02-10 PLC man-machine communication's method and system

Publications (2)

Publication Number Publication Date
CN104698962A CN104698962A (en) 2015-06-10
CN104698962B true CN104698962B (en) 2017-11-17

Family

ID=53346199

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510070349.7A Active CN104698962B (en) 2015-02-10 2015-02-10 PLC man-machine communication's method and system

Country Status (1)

Country Link
CN (1) CN104698962B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102014108027A1 (en) 2014-06-06 2015-12-17 Thyssenkrupp Ag Flange for connecting a vibration damper tube with a module tube of a vibration damper
CN109861790A (en) * 2019-01-16 2019-06-07 顺丰科技有限公司 Data transmission method and device
CN111123824A (en) * 2019-12-19 2020-05-08 深圳华侨城文化旅游科技集团有限公司 PLC debugging system and debugging method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7523083B2 (en) * 2003-09-25 2009-04-21 Rockwell Automation Technologies, Inc. Location-based execution of software/HMI
CN101673107A (en) * 2008-09-09 2010-03-17 上海轻工业研究所有限公司 Multi-path serial communication converter and distributed control system applied by same
KR20100125722A (en) * 2009-05-21 2010-12-01 엘에스산전 주식회사 Hmi system
CN103631195A (en) * 2013-12-03 2014-03-12 苏州镭明激光科技有限公司 Lab view (laboratory virtual instruments engineering workbench) and PLC (programmable logic controller) based serial port communication control method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7523083B2 (en) * 2003-09-25 2009-04-21 Rockwell Automation Technologies, Inc. Location-based execution of software/HMI
CN101673107A (en) * 2008-09-09 2010-03-17 上海轻工业研究所有限公司 Multi-path serial communication converter and distributed control system applied by same
KR20100125722A (en) * 2009-05-21 2010-12-01 엘에스산전 주식회사 Hmi system
CN103631195A (en) * 2013-12-03 2014-03-12 苏州镭明激光科技有限公司 Lab view (laboratory virtual instruments engineering workbench) and PLC (programmable logic controller) based serial port communication control method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于Linux的人机界面可重构通信设计与实现;张成兰,陈迪军,帅金荣,马杰,周纯杰;《计算机工程与应用》;20110301;第47卷(第7期);第61页第1栏第2段-第2栏第2段,第62页第1栏第5段-第8段,图1 *
基于Modbus协议的S7-200PLC主从结构的通信技术研究;武朝,徐聪,张文君;《机械与电子》;20111231(第4期);第27页第0节引言,第28页第2节,第3节第1段-第3段 *

Also Published As

Publication number Publication date
CN104698962A (en) 2015-06-10

Similar Documents

Publication Publication Date Title
CN104698962B (en) PLC man-machine communication's method and system
CN104932364B (en) The OPC UA conversion equipments and method of a kind of Modbus communications protocol
CN103944813A (en) Gateway and method for achieving general adaptation function
CN102801723B (en) Internet of things access equipment and method
CN101626333A (en) Controller area network (CAN) bus system and application layer communication method in same
CN102104883A (en) Method and system for defining information in machine-to-machine (M2M) platform and M2M platform
CN103546354A (en) Communicating method being based on Internet of Things electric temperature measurement equipment and enabling RS485 bus and CAN bus to be compatible
CN103634161A (en) Train communication protocol consistency detection device and train communication protocol consistency detection method
CN204360184U (en) A kind of Modbus equipment master-salve station communication management system based on real-time data base
CN103326936A (en) Multi-protocol gateway of Internet of Things allowing unified access of various heterogeneous sensing layer networks
CN100579114C (en) Method for converting protocol between Modbus and DeviceNet
CN109739915B (en) Cross-domain shared data model construction method
CN106982222A (en) The multi-protocol data cut-in method and device that can configure under a kind of industrial 4.0 environment
CN104407591A (en) Communication management method for master station and slave station of Modbus device based on real-time database, and communication management system for master station and slave station of Modbus device based on real-time database
CN106533850A (en) Panel scene control method based on NFC card mode
US20090309692A1 (en) Method for parameterizing a process automation field device by simulating the acyclic services
CN103905410A (en) Multi-channel communication protocol converter capable of converting user-defined protocol to Modbus protocol
CN203219328U (en) Multiplex communication protocol converter
CN106709060A (en) Data sharing method and system
CN104158903A (en) Method and system of encoding OAM (Operation Administration and Maintenance) protocol stack
CN104734900A (en) Sending control method for communication protocol testing
US20110252169A1 (en) Method for Data Exchange
CN101398884A (en) Smart card reader and its use method
CN107861455A (en) The Visualized management system and method for a kind of programmable controller
CN107885691A (en) Serial data transmission method, distributed apparatus and main frame

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant