Thread Content
The two most commonly used programming languages for PLCs are ladder diagrams and mnemonic language tables. Ladder diagram programming is used because it is intuitive and easy to understand, but it requires a personal computer along with the corresponding programming software ; Using a mnemonic form facilitates experimentation, as it only requires a simple programmer, without the need for expensive graphical programmers or computers for programming. Although some high-end PLCs also have computer-compatible languages such as C and BASIC, as well as specialized high-level languages like Siemens’ GRAPH5 and Mitsubishi’s MELSAP, in addition to Boolean logic languages and assembly languages compatible with general computers. In any case, the programming languages used by various manufacturers are only applicable to their own products. l Programming instructions: Instructions are the code or symbols that tell the PLC what to do and how to do it. Essentially, instructions are just binary code, and in this regard PLCs are exactly the same as ordinary computers. At the same time, PLCs also have a compilation system that can convert textual symbols or graphic symbols into machine code; therefore, the PLC instructions that users see are generally not in machine code but rather in textual form or as graphic symbols. Common mnemonic statements use abbreviations in English (or multiple languages) and numbers to represent the corresponding instructions. The commonly used graphic symbol is the ladder diagram, which is similar to electrical schematic diagrams in that it consists of symbols and is easily understood by electrical technicians. Instruction set: The collection of instructions that a PLC possesses is known as that PLC’s instruction set. It includes the number of instructions and what each instruction can do, representing the functionality and performance of the PLC. Generally speaking, a PLC with strong functionality and good performance necessarily has a rich instruction set, allowing it to perform more tasks. Before programming, we must understand the PLC’s instruction set: a sequence of PLC instructions that the PLC uses to carry out corresponding tasks. Of course, the program referred to here is the PLC’s user program. User programs are generally designed by the users; they are not provided by PLC manufacturers or distributors. Programs expressed in statements are not very intuitive and have poor readability; especially for more complex programs, they are even harder to read. Therefore, most programs are represented using ladder diagrams. l Ladder diagram: A ladder diagram is a connected graph that joins the ladder symbols of PLC instructions through lines, used to represent the PLC instructions employed and their sequence; it is quite similar to an electrical schematic diagram. It has two types of connections: one is the busbar, and the other are the internal horizontal and vertical lines. Internal horizontal and vertical lines connect the individual ladder diagram symbol instructions into a set of instructions; this set generally starts with an LD instruction, and if necessary, is followed by several input instructions (including the LD instruction) in order to establish logical conditions. Finally, there are output-related commands used to achieve output control, as well as commands for data control, process control, communication handling, monitoring, and other tasks, in order to carry out the corresponding operations. Buses are used to connect groups of instructions. The diagram below shows the simplest ladder diagram for Mitsubishi’s FX2N series of products: X000 X001 Y000 X010 END. There are two sets in this diagram; the first set is used to control starting and stopping. The second group contains only one END instruction, which is used to terminate the program. l The correspondence between ladder diagrams and mnemonics: There is a strict correspondence between mnemonic instructions and ladder diagram instructions, and the connections in the ladder diagram reflect the order of these instructions. Generally speaking, the order is: input first, then output (including other processing) ; Up first, then down ; Left first, then right. With a ladder diagram, it can be translated into a mnemonic program. The mnemonic program for the diagram above is: Address Instruction Variable 0000 LD X000 0001 OR X010 0002 AND NOT X001 0003 OUT Y000 0004 END Conversely, based on these mnemonics, a corresponding ladder diagram can also be drawn. l The relationship between ladder diagrams and electrical schematic diagrams: If only logical control is considered, a certain correspondence can also be established between ladder diagrams and electrical schematic diagrams. For example, the OUT command in ladder logic corresponds to the coil of a relay, while input commands such as LD, AND, and OR correspond to contacts; interlock commands (IL, ILC) can be regarded as master switches, and so on. In this way, the original relay control logic can be converted into a ladder diagram, and with further conversion, it can be turned into a statement table program. With this correspondence, it is easy to represent relay logic using PLC programs. This is also an inheritance of PLC technology from traditional relay control technology.