Generic programming rules

Programming involves the entire process of design, coding, debugging and maintaining software. A computer program is a series of instructions that tells a computer or microprocessor to perform certain tasks. Regardless of the software development platform, the final program must satisfy some basic requirements.

10/20/2014


This is an excerpt from Industrial Automation: Hands On that applies to all programs, not just ladder (6.1.1 - Programming Concepts): "Programming involves the entire process of design, coding, debugging and maintaining software. A computer program is a series of instructions that tells a computer or microprocessor to perform certain tasks. In the automation field, the processor of these instructions may be a controller, such as a PLC, DCS, embedded processor or robot controller. A computer may also execute instructions for data acquisition and display, database operations or control functions. Programs may be written in a low level, machine-specific language or in a high level machine-independent language.

In automation, digital values of "On" and "Off," True or False, or 1 and 0 represents inputs and outputs. Conditional statements such as "If," "Then," "Else," "And," and "Or" are used in combination with variables to make statements that create the desired result. Variables are names that may represent physical I/O, data values in string, number or Boolean form or internal data. Variables may be as simple as a single letter, as in the statement "IF X AND Y, THEN Z," or they can be more descriptive, such as in "IF Motor_On AND Button_Pressed, THEN Conveyor_On." Descriptive variables, such as those stated in the previous sentence, are known as tags. In a dedicated controller, such as a PLC or DCS, there are usually registers dedicated to different types of data. Tags may then represent different types of data, such as bits, integers, floating point or REAL, timers and counters. Some PLC platforms allow the programmer to choose which registers are used for which data type and size memory accordingly.

The representation of a program may be text-based, using alphanumeric characters, or graphical in nature. Ladder logic, used in PLC programming, uses representations of electrical components, such as contacts and coils. Some software uses blocks similar to flow charts to program. The code inside of these blocks may take another form, such as text or ladder logic. HMI and other visual programs have a graphical representation of the screen that will be displayed to the user. Entering the tag or variable it interfaces with configures objects on that screen. Logical functions are sometimes embedded in the objects to execute when the user activates them.

Regardless of the software development platform, the final program must satisfy some basic requirements. The program must be:

  • Reliable: algorithms must produce the correct results, resources, such as buffer and data allocation size, should be correctly used, and there should be no logic errors.
  • Robust: the program should anticipate problems not due to programmer error, such as incorrect input and corrupted data.
  • Usable: textual, graphical and even hardware elements should improve the clarity, intuitiveness and completeness of the user interface.
  • Portable: software should be able to run on all of the hardware and operating systems for which it is designed. Some software development programs only operate for the manufacturer's proprietary hardware.
  • Maintainable: present or future developers should be able to easily modify the code for improvements or customizations, fix bugs or adapt it to new environments. Good practices and documentation during initial development help in this regard.
  • Efficient: the code should consume as few resources as possible, memory leaks should be eliminated and unused code deleted.

After talking to a lot of software companies in the Nashville area I have decided to try and develop the prototype myself in Microsoft Excel. Much of the code supporting the application will therefore be in VBA (Visual Basic for Applications). The above rules certainly apply in this case.



The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by Control Engineering subscribers. Vote now (if qualified)!
The System Integrator Giants program lists the top 100 system integrators among companies listed in CFE Media's Global System Integrator Database.
Each year, a panel of Control Engineering and Plant Engineering editors and industry expert judges select the System Integrator of the Year Award winners in three categories.
This eGuide illustrates solutions, applications and benefits of machine vision systems.
Learn how to increase device reliability in harsh environments and decrease unplanned system downtime.
This eGuide contains a series of articles and videos that considers theoretical and practical; immediate needs and a look into the future.
HMI effectiveness; Distributed I/O; Engineers' Choice Award finalists; System Integrator advice; Inside Machines
Women in engineering; Engineering Leaders Under 40; PID benefits and drawbacks; Ladder logic; Cloud computing
Robotic integration and cloud connections; SCADA and cybersecurity; Motor efficiency standards; Open- and closed-loop control; Augmented reality
Programmable logic controllers (PLCs) represent the logic (decision) part of the control loop of sense, decide, and actuate. As we know, PLCs aren’t the only option for making decisions in a control loop, but they are likely why you’re here.
This digital report explains how motion control advances and solutions can help with machine control, automated control on assembly lines, integration of robotics and automation, and machine safety.
This article collection contains several articles on how advancements in vision system designs, computing power, algorithms, optics, and communications are making machine vision more cost effective than ever before.

Find and connect with the most suitable service provider for your unique application. Start searching the Global System Integrator Database Now!

Control room technology innovation; Practical approaches to corrosion protection; Pipeline regulator revises quality programs
Cloud, mobility, and remote operations; SCADA and contextual mobility; Custom UPS empowering a secure pipeline
Infrastructure for natural gas expansion; Artificial lift methods; Disruptive technology and fugitive gas emissions
Automation Engineer; Wood Group
System Integrator; Cross Integrated Systems Group
Jose S. Vasquez, Jr.
Fire & Life Safety Engineer; Technip USA Inc.
This course focuses on climate analysis, appropriateness of cooling system selection, and combining cooling systems.
This course will help identify and reveal electrical hazards and identify the solutions to implementing and maintaining a safe work environment.
This course explains how maintaining power and communication systems through emergency power-generation systems is critical.
The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by Control Engineering subscribers. Vote now (if qualified)!
The System Integrator Giants program lists the top 100 system integrators among companies listed in CFE Media's Global System Integrator Database.
Each year, a panel of Control Engineering and Plant Engineering editors and industry expert judges select the System Integrator of the Year Award winners in three categories.
This eGuide illustrates solutions, applications and benefits of machine vision systems.
Learn how to increase device reliability in harsh environments and decrease unplanned system downtime.
This eGuide contains a series of articles and videos that considers theoretical and practical; immediate needs and a look into the future.
HMI effectiveness; Distributed I/O; Engineers' Choice Award finalists; System Integrator advice; Inside Machines
Women in engineering; Engineering Leaders Under 40; PID benefits and drawbacks; Ladder logic; Cloud computing
Robotic integration and cloud connections; SCADA and cybersecurity; Motor efficiency standards; Open- and closed-loop control; Augmented reality
Programmable logic controllers (PLCs) represent the logic (decision) part of the control loop of sense, decide, and actuate. As we know, PLCs aren’t the only option for making decisions in a control loop, but they are likely why you’re here.
This digital report explains how motion control advances and solutions can help with machine control, automated control on assembly lines, integration of robotics and automation, and machine safety.
This article collection contains several articles on how advancements in vision system designs, computing power, algorithms, optics, and communications are making machine vision more cost effective than ever before.

Find and connect with the most suitable service provider for your unique application. Start searching the Global System Integrator Database Now!

Control room technology innovation; Practical approaches to corrosion protection; Pipeline regulator revises quality programs
Cloud, mobility, and remote operations; SCADA and contextual mobility; Custom UPS empowering a secure pipeline
Infrastructure for natural gas expansion; Artificial lift methods; Disruptive technology and fugitive gas emissions
Automation Engineer; Wood Group
System Integrator; Cross Integrated Systems Group
Jose S. Vasquez, Jr.
Fire & Life Safety Engineer; Technip USA Inc.
This course focuses on climate analysis, appropriateness of cooling system selection, and combining cooling systems.
This course will help identify and reveal electrical hazards and identify the solutions to implementing and maintaining a safe work environment.
This course explains how maintaining power and communication systems through emergency power-generation systems is critical.
The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by Control Engineering subscribers. Vote now (if qualified)!
The System Integrator Giants program lists the top 100 system integrators among companies listed in CFE Media's Global System Integrator Database.
Each year, a panel of Control Engineering and Plant Engineering editors and industry expert judges select the System Integrator of the Year Award winners in three categories.
This eGuide illustrates solutions, applications and benefits of machine vision systems.
Learn how to increase device reliability in harsh environments and decrease unplanned system downtime.
This eGuide contains a series of articles and videos that considers theoretical and practical; immediate needs and a look into the future.
HMI effectiveness; Distributed I/O; Engineers' Choice Award finalists; System Integrator advice; Inside Machines
Women in engineering; Engineering Leaders Under 40; PID benefits and drawbacks; Ladder logic; Cloud computing
Robotic integration and cloud connections; SCADA and cybersecurity; Motor efficiency standards; Open- and closed-loop control; Augmented reality
Programmable logic controllers (PLCs) represent the logic (decision) part of the control loop of sense, decide, and actuate. As we know, PLCs aren’t the only option for making decisions in a control loop, but they are likely why you’re here.
This digital report explains how motion control advances and solutions can help with machine control, automated control on assembly lines, integration of robotics and automation, and machine safety.
This article collection contains several articles on how advancements in vision system designs, computing power, algorithms, optics, and communications are making machine vision more cost effective than ever before.

Find and connect with the most suitable service provider for your unique application. Start searching the Global System Integrator Database Now!

Control room technology innovation; Practical approaches to corrosion protection; Pipeline regulator revises quality programs
Cloud, mobility, and remote operations; SCADA and contextual mobility; Custom UPS empowering a secure pipeline
Infrastructure for natural gas expansion; Artificial lift methods; Disruptive technology and fugitive gas emissions
Automation Engineer; Wood Group
System Integrator; Cross Integrated Systems Group
Jose S. Vasquez, Jr.
Fire & Life Safety Engineer; Technip USA Inc.
This course focuses on climate analysis, appropriateness of cooling system selection, and combining cooling systems.
This course will help identify and reveal electrical hazards and identify the solutions to implementing and maintaining a safe work environment.
This course explains how maintaining power and communication systems through emergency power-generation systems is critical.
click me