Tuesday, July 26, 2011

Coding Rules PLC Programming Languages

[CR 1] It is a general rule that all possible should be executed throughout coding rather than by configuration. Some characteristics can be realized by simply configuring the CPU with nearly no coding. It may enlarge development time to favor coding, but coding as some benefits:
• It is easier to track modifications of code than modifications of configuration. Maintenance will be simpler especially where some users succeed each other for the program maintenance.
• The project will face a least one improve to the Siemens PLCs next generation. Code will be moveable in the main, but no statements regarding configuration of CPU can be made. Favoring coding is a good method to lessen the risks of migration.

[CR 2] In LD or in FBD Programming must be done in the same method as if it was an electrical or an electronic diagram. The coils or latches writing must be unique. Setting spreading and variables resetting through the code is forbidden.

[CR 3] In SCL (“FOR”, “WHILE”, …) loops should be utilized instead of backward jumps in IL. Backward jumps are difficult and dangerous to troubleshoot, in the same method as any instruction of goto.

[CR 4] The arguments or passing from one block to other will be completed throughout the FBs interface or FCs: Output Variable, Input Variable. Use of joint DB global variables straightly in the control block is forbidden. Nevertheless, this is not always technically probable, so exemptions will be obviously stated in PCDH This rule will:
• Create the portable code.
• Shorten the variables length inside the blocks.
• Create easier blocks unit testing.

[CR 5] Use only joint DB variables, instead of mementos. The benefit of using DBs is that variables can be functionally grouped. This helps in the code structuring. Therefore the use of mementos is forbidden.

[CR 6] Use memories clock as far as possible. Memories clock can be utilized to produce up to 50 ms delay. This is delay is adequate to control most industrial control problems. This creates the code easier and more portable to unit test.

[CR 7] Organization blocks will comprise only calls to manage blocks. The logic implementation in the OBs is forbidden.
[CR 8] Each variable, block must be commented.
[CR 9] No programming of logic in LST. Use FBD/LD.
[CR 10]Every network: Maximum 1 landscape page of A4. If not possible, use Variables of intermediate TEMP.
[CR 11] The use of the inputs of “Enable” blocks of FBD and LD is forbidden.
[CR 12] No use instruction of “OPN DB”. Use the complete absolute joint DB variable: WFC. PL1-C, …
[CR 13] No explicit to use the instructions of address register in IL.

Newer Post Older Post Home

You may also like these ebook:

Get Free PLC eBook directly sent to your email,
and email subscription to program-plc.blogspot.com

We hate SPAM. Your information is never sold or shared with anyone.

Your Email Will Be 100% Secured !