CN107291038A - A kind of PLC software instruction parsing execution method - Google Patents
A kind of PLC software instruction parsing execution method Download PDFInfo
- Publication number
- CN107291038A CN107291038A CN201710624911.5A CN201710624911A CN107291038A CN 107291038 A CN107291038 A CN 107291038A CN 201710624911 A CN201710624911 A CN 201710624911A CN 107291038 A CN107291038 A CN 107291038A
- Authority
- CN
- China
- Prior art keywords
- instruction
- logic state
- function
- module
- decoding
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B19/00—Programme-control systems
- G05B19/02—Programme-control systems electric
- G05B19/04—Programme control other than numerical control, i.e. in sequence controllers or logic controllers
- G05B19/05—Programmable logic controllers, e.g. simulating logic interconnections of signals according to ladder diagrams or function charts
- G05B19/054—Input/output
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B2219/00—Program-control systems
- G05B2219/10—Plc systems
- G05B2219/11—Plc I-O input output
- G05B2219/1103—Special, intelligent I-O processor, also plc can only access via processor
Abstract
The invention discloses a kind of PLC instruction parsing execution methods, including Instruction decoding, instruction are performed, logic state is managed, function nesting four steps of management.The invention also discloses a kind of PLC instruction parsing execution systems, including Instruction decoding module, instruction performing module, logic state management module management module nested with function.It is greatly lowered the invention enables the coupling between instruction, enhances the scalability of system, and ensures that system is reliable and stable.
Description
Technical field
The invention belongs to industrial control field, specifically a kind of PLC software instruction parsing execution method.
Background technology
PLC is a new generation's industry grown up based on automatic control technology, micro-computer technology and the communication technology
Control device, with the development of microprocessor technology, PLC has obtained rapid development, and the also production in social each field is instructed
Increasing application is arrived.PLC be at home and abroad widely used to steel, oil, chemical industry, electric power, building materials, machine-building,
The industry-by-industries such as automobile, light textile, communications and transportation, environmental protection and entertainment.
In ladder diagram into instruction catalogue transfer process, the hardware chip that traditional PLC system is used realizes that ladder diagram is scanned, and leads
Ladder diagram instruction set is caused to update difficult, PLC firmware updates and needs to take longer time cycle and cost.
The content of the invention
In order to solve above-mentioned technical problem present in prior art, performed the invention provides a kind of PLC instruction parsings
Method, including Instruction decoding, instruction are performed, logic state is managed, function nesting four steps of management,
Step 1: Instruction decoding, reads instruction code, and the validity of instruction and parameter is carried out according to instruction pointer instruction order
Judge, if it find that data are illegal or data out-of-bounds access, then report an error;
Step 2: instruction is performed, corresponding instruction processing function is jumped to according to Instruction decoding result, instruction processing function extracts each
The parameter needed carries out computing, and every instruction can all export corresponding logic state after the completion of performing, logical validity or invalid should
Logic state can be submitted to logic state management process and be controlled with carrying out logical operation and terraced figure instruction scan;
Step 3: logic state is managed, nearest logic operation result is recorded, a logic shape is produced per a line ladder diagram correspondence
State, each time computing can all produce a logic state and be supplied to latter instruction, to judge whether to perform subsequent instructions;
Step 4: function nesting management, be responsible for function call and interrupt processing response, jump to called function it
Before, can push on preservation to current context environmental, and then instruction pointer points to pending function entrance, next finger
Row decoding execution is entered in the address that making can be automatically brought to pointed by instruction pointer;Above and below function is preserved before being popped after having performed
Literary environmental data, instruction pointer returns to order at next instruction for redirecting the preceding location of instruction and performed.
Further, step one is specially:Read according to instruction pointer after director data, first determine whether instruction code whether be
The effective instruction that controller is supported;Then the parameter list that instruction is relied on is isolated from director data, and judges that parameter is constant
Or address of variable, also needs to differentiate whether address is effective system address, while checking corresponding operation for address of variable
Whether data can be caused to cross the border, if all gone well, start to perform corresponding instruction, otherwise into alarm condition, stopped PLC and hold
OK, prevent from performing the action of mistake.
Further, can automatic pop down preservation present logic state, present logic state when there is branch in step 3
It is respectively supplied to all branches to use, the logic once preserved on last column branch pops automatically.System is according to current
Logic state, judges whether to perform next step instruction.
The invention also discloses a kind of PLC instruction parsing execution system, including Instruction decoding module, instruction performing module,
Logic state management module management module nested with function,
Instruction decoding module, reads instruction code, and the validity of instruction and parameter is examined according to instruction pointer instruction order
Look into.
Performing module is instructed, corresponding instruction processing function is jumped to according to decoding result, processing function extracts each needs
Parameter carries out computing, and produces logic state;
Logic state management module, it records nearest logical operation state, and each ladder figure instruction can all produce a logic
State.Module judges whether to perform next ordering calculation according to logic state above.
Function nesting management module, management function is called to be responded with interrupt processing, to support the multinest of function to call.
It is greatly lowered the invention enables the coupling between instruction, enhances the scalability of system, and ensures that system is stable
Reliably.
Brief description of the drawings
The PLC instruction parsings that Fig. 1 is the present invention perform method flow diagram;
Fig. 2 is logic state and ordering calculation graph of a relation.
Embodiment
The invention will be further described below in conjunction with the accompanying drawings.
As shown in figure 1, the PLC instruction parsing execution methods of the present invention, mainly including Instruction decoding, instruction execution, logic
Condition managing, function nesting four steps of management.
Step 1: Instruction decoding, instruction code is read according to instruction pointer instruction order, and to instruction and the validity of parameter
Judged, if it find that data are illegal or data out-of-bounds access, then reported an error.
Read according to instruction pointer after director data, first determine whether instruction code whether be controller support effective instruction;
Then the parameter list that instruction is relied on is isolated from director data, and judges that parameter is constant or address of variable, for variable
Address also needs to differentiate whether address is effective system address, while checking whether corresponding operation can cause data to be crossed the border, such as
Fruit all goes well, then starts to perform corresponding instruction, otherwise into alarm condition, stops PLC and performs, and prevents from performing the dynamic of mistake
Make;
Step 2: instruction is performed, corresponding instruction processing function is jumped to according to Instruction decoding result, instruction processing function extracts each
The parameter needed carries out computing, and every instruction can all export corresponding logic state after the completion of performing, logical validity or invalid should
Logic state can be submitted to logic state management process and be controlled with carrying out logical operation and terraced figure instruction scan;
Step 3: logic state is managed, nearest logic operation result is recorded, a logic shape is produced per a line ladder diagram correspondence
State, each time computing can all produce a logic state and be supplied to latter instruction, to judge whether to perform subsequent instructions.
When there is branch can automatic pop down preservation present logic state, present logic state, which is respectively supplied to all branches, to be made
With the logic once preserved on last column branch pops automatically.System judges whether to perform according to current logic state
Next step is instructed;
Step 4: function nesting management, be responsible for function call and interrupt processing response, jump to called function it
Before, can push on preservation to current context environmental, and then instruction pointer points to pending function entrance, next finger
Row decoding execution is entered in the address that making can be automatically brought to pointed by instruction pointer;Above and below function is preserved before being popped after having performed
Literary environmental data, instruction pointer returns to order at next instruction for redirecting the preceding location of instruction and performed.
The PLC instruction parsing execution systems of the present invention, including Instruction decoding module, instruction performing module, logic state pipe
Manage module management module nested with function.
Instruction decoding module, reads instruction code, and the validity of instruction and parameter is entered according to instruction pointer instruction order
Row is checked.
Performing module is instructed, corresponding instruction processing function is jumped to according to decoding result, processing function extracts each needs
Parameter carries out computing, and produces logic state;
Logic state management module, it records nearest logical operation state, and each ladder figure instruction can all produce a logic
State.Module judges whether to perform next ordering calculation according to logic state above.
Function nesting management module, management function is called to be responded with interrupt processing, to support the multinest of function to call.
As shown in Fig. 2 due to being only scheduled control between instruction with logic state, user is by changing ladder figure instruction
The modes such as data mode, location of instruction order, branched structure change the logic state of output, and subsequent instructions are according to above exporting
Logic state effectively whether judge whether to need the execute instruction computing (or skip present instruction, directly perform next
Instruction), judge whether to export effective logic state.Because the operation result and generation logic state of instruction itself are mutually solely
Vertical, therefore whether ordering calculation result does not interfere with whether next instruction is performed correctly.And for the scanning of ladder figure only
The logic state for ensureing instruction output is needed correctly to ensure that terraced figure scanning sequency is correctly reliable.
Claims (4)
1. a kind of PLC instructions parsing execution method, including Instruction decoding, instruction are performed, logic state is managed, function nesting management
Four steps, it is characterised in that:
Step 1: Instruction decoding, reads instruction code, and the validity of instruction and parameter is carried out according to instruction pointer instruction order
Judge, if it find that data are illegal or data out-of-bounds access, then report an error;
Step 2: instruction is performed, corresponding instruction processing function is jumped to according to Instruction decoding result, instruction processing function extracts each
The parameter needed carries out computing, and every instruction can all export corresponding logic state after the completion of performing, logical validity or invalid should
Logic state can be submitted to logic state management process and be controlled with carrying out logical operation and terraced figure instruction scan;
Step 3: logic state is managed, nearest logic operation result is recorded, a logic shape is produced per a line ladder diagram correspondence
State, each time computing can all produce a logic state and be supplied to latter instruction, to judge whether to perform subsequent instructions;
Step 4: function nesting management, be responsible for function call and interrupt processing response, jump to called function it
Before, can push on preservation to current context environmental, and then instruction pointer points to pending function entrance, next finger
Row decoding execution is entered in the address that making can be automatically brought to pointed by instruction pointer;Above and below function is preserved before being popped after having performed
Literary environmental data, instruction pointer returns to order at next instruction for redirecting the preceding location of instruction and performed.
2. PLC instructions parsing execution method as claimed in claim 1, it is characterised in that:
Step one is specially:Read according to instruction pointer after director data, whether first determine whether instruction code is what controller was supported
Effective instruction;Then isolate from director data the parameter list that instruction is relied on, and judge that parameter is constant or address of variable,
Also need to differentiate whether address is effective system address for address of variable, while checking whether corresponding operation can cause data
Cross the border, if all gone well, start to perform corresponding instruction, otherwise into alarm condition, stop PLC and perform, prevent from performing mistake
Action by mistake.
3. PLC instructions parsing execution method as claimed in claim 1, it is characterised in that:
In step 3, when there is branch can automatic pop down preserve present logic state, present logic state is respectively supplied to institute
There is branch to use, the logic once preserved on last column branch pops automatically;System judges according to current logic state
Whether next step instruction is performed.
4. a kind of PLC instructions parsing execution system, including Instruction decoding module, instruction performing module, logic state management module
Management module nested with function, it is characterised in that:
Instruction decoding module, reads instruction code, and the validity of instruction and parameter is examined according to instruction pointer instruction order
Look into;
Performing module is instructed, corresponding instruction processing function is jumped to according to decoding result, processing function extracts the parameter of each needs
Computing is carried out, and produces logic state;
Logic state management module, it records nearest logical operation state, and each ladder figure instruction can all produce a logic
State;
Module judges whether to perform next ordering calculation according to logic state above;
Function nesting management module, management function is called to be responded with interrupt processing, to support the multinest of function to call.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710624911.5A CN107291038B (en) | 2017-07-27 | 2017-07-27 | A kind of PLC software instruction parsing execution method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710624911.5A CN107291038B (en) | 2017-07-27 | 2017-07-27 | A kind of PLC software instruction parsing execution method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107291038A true CN107291038A (en) | 2017-10-24 |
CN107291038B CN107291038B (en) | 2019-04-02 |
Family
ID=60103440
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710624911.5A Active CN107291038B (en) | 2017-07-27 | 2017-07-27 | A kind of PLC software instruction parsing execution method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107291038B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108920186A (en) * | 2018-06-25 | 2018-11-30 | 杭州电子科技大学 | A kind of movement instruction analysis method and device |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101364098A (en) * | 2008-09-12 | 2009-02-11 | 南京航空航天大学 | Method and system for conversing trapezoidal pattern to be instruction catalogue program, and interpretation execution method and system |
CN101533263A (en) * | 2009-02-17 | 2009-09-16 | 固高科技(深圳)有限公司 | Computer programmable autocontrol system and control method thereof |
CN102354144A (en) * | 2011-09-06 | 2012-02-15 | 北京联合大学 | Method for converting ladder diagram into PLC (Programmable Logic Controller) program command |
CN102393670A (en) * | 2011-10-24 | 2012-03-28 | 杭州电子科技大学 | Method for realizing hybrid programming by embedding high-level language into ladder diagram |
CN102650861A (en) * | 2012-05-04 | 2012-08-29 | 深圳市矩形科技有限公司 | PLC ladder diagram code hardware problem solving method |
-
2017
- 2017-07-27 CN CN201710624911.5A patent/CN107291038B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101364098A (en) * | 2008-09-12 | 2009-02-11 | 南京航空航天大学 | Method and system for conversing trapezoidal pattern to be instruction catalogue program, and interpretation execution method and system |
CN101533263A (en) * | 2009-02-17 | 2009-09-16 | 固高科技(深圳)有限公司 | Computer programmable autocontrol system and control method thereof |
CN102354144A (en) * | 2011-09-06 | 2012-02-15 | 北京联合大学 | Method for converting ladder diagram into PLC (Programmable Logic Controller) program command |
CN102393670A (en) * | 2011-10-24 | 2012-03-28 | 杭州电子科技大学 | Method for realizing hybrid programming by embedding high-level language into ladder diagram |
CN102650861A (en) * | 2012-05-04 | 2012-08-29 | 深圳市矩形科技有限公司 | PLC ladder diagram code hardware problem solving method |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108920186A (en) * | 2018-06-25 | 2018-11-30 | 杭州电子科技大学 | A kind of movement instruction analysis method and device |
Also Published As
Publication number | Publication date |
---|---|
CN107291038B (en) | 2019-04-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11381645B2 (en) | Internet of things configurable event and action sequencing framework | |
CN105159122A (en) | Smart home control system and control method | |
CN102291593B (en) | System configuring and testing method in production of IPTV (Internet Protocol Television) set top box | |
CN110442498A (en) | Localization method, device, storage medium and the computer equipment of abnormal data node | |
CN104980552B (en) | Realize the method and system of Android mobile terminal automatic test | |
CN104503841A (en) | Process clearing method and process clearing device | |
CN110569250B (en) | Management method and device for analysis library of Internet of things network element | |
CN107992407A (en) | System and method using USB flash disk to android terminal equipment debugging | |
CN102833120B (en) | The abnormal method and system of NM server are processed in a kind of rapid automatized test | |
CN104881019A (en) | Appliance fault network maintenance system and method | |
CN107479878B (en) | Lua modularization development method and development framework based on openness | |
CN105721831A (en) | Method for designing video monitoring client side based on multi-process architecture | |
CN109766112A (en) | A kind of method and device of program white list knowledge base update | |
CN107464083B (en) | Method, device and equipment for generating bill of materials | |
CN105812414A (en) | VNF deployment method and device | |
CN103886249A (en) | Method and device for executing processes under superuser right in system | |
CN106095413A (en) | The collocation method of a kind of bluetooth driver and device | |
CN107291038A (en) | A kind of PLC software instruction parsing execution method | |
CN105791063A (en) | Method and device for controlling intelligent household appliance | |
CN107807956A (en) | Electronic installation, data processing method and computer-readable recording medium | |
CN111435227A (en) | Smart home equipment testing method, device, equipment and medium | |
CN106781369A (en) | Robot operation control method, robot shutdown control method and device | |
CN106779438A (en) | A kind of intelligent building management platform data method for organizing for being adapted to many producers | |
CN103744766A (en) | Working method of monitoring system | |
CN106292584A (en) | A kind of flexible manufacturing system based on modular control unit |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |