【正文】
ult this will indicate when the PLC has experienced a major hardware or software problem These lights are normally used for debugging. Limited buttons will also be provided for PLC hardware. The most mon will be a run/program switch that will be switched to program when maintenance is being conducted, and back to run when in production. This switch normally requires a key to keep unauthorized personnel from altering the PLC program or stopping execution. A PLC will almost never have an onoff switch or reset button on the front. This needs to be designed into the remainder of the system. The status of the PLC can be detected by ladder logic also. It is mon for programs to check to see if they are being executed for the first time, as shown in Figure 6. The ’first scan’ input will be true on the very first time the ladder logic is scanned, but false on every other scan. In this case the address for ’first scan’ in a PLC5 is ’S2:1/14’. With the logic in the example the first scan will seal on ’light’, until ’clear’ is turned on. So the light will turn on after the PLC has 畢業(yè)設(shè)計(jì)(論文)外文翻譯 8 been turned on, but it will turn off and stay off after ’clear’ is turned on. The ’first scan’ bit is also referred to at the ’first pass’ bit. Figure 6 An program that checks for the first scan of the PLC 5 。 2 The Logic Scan Ladder logic programs are modelled after relay logic. In relay logic each element in the ladder will switch as quickly as possible. But in a program elements can only be examines one at a time in a fixed sequence. Consider the ladder logic in Figure 4, the ladder logic will be interpreted lefttoright, toptobottom. In the figure the ladder logic scan begins at the top rung. At the end of the rung it interprets the top output first, then the output branched below it. On the second rung it solves branches, before moving along the ladder logic rung. Figure 4 Ladder Logic Execution Sequence The logic scan sequence bee important when solving ladder logic programs which use outputs as inputs. It also bees important when considering output usage. Consider Figure 5, the first line of ladder logic will examine input A and set output X to have the same value. The second line will examine input B and set the output X to have the opposite value. So the value of X was only equal to A until the second line of ladder logic was scanned. Recall that during the logic scan the outputs are only changed in memory, the actual outputs are only updated when the ladder logic scan is plete. Therefore the output scan would update the real outputs based 畢業(yè)設(shè)計(jì)(論文)外文翻譯 7 upon the second line of ladder logic, and the first line of ladder logic would be ineffective. Figure 5 A Duplicated Output Error 4 。 OPERATION SEQUENCE All PLCs have four basic stages of operations that are repeated many times per second. Initially when turned on the first time it will check it’s own hardware and software for faults. If there are no problems it will copy all the input and copy their values into memory, this is called the input scan. Using only the memory copy of the inputs the ladder logic program will be solved once, this is called the logic scan. While solving the ladder logic the output values are only changed in temporary memory. When the ladder scan is done the outputs will be updated using the temporary values in memory, this is called the output scan. The PLC now restarts the process by starting a self check for faults. This process typically repeats 10 to 100 times per second as is shown in Figure 3. 畢業(yè)設(shè)計(jì)(論文)外文翻譯 5 Figure 3 PLC Scan Cycle SELF TEST Checks to see if all cards error free, reset watchdog timer, etc. (A watchdog timer will cause an error, and shut down the PLC if not reset within a short period of time this would indicate that the ladder logic is not being scanned normally). INPUT SCAN Reads input values from the chips in the input cards, and copies their values to memory. This makes the PLC operation faster, and avoids cases where an input changes from the start to the end of the program (., an emergency stop). There are special PLC functions that read the inputs directly, and avoid the input tables. LOGIC SOLVE/SCAN Based on the input table in memory, the program is executed 1 step at a time, and outputs are updated. This is the focus of the later sections. OUTPUT SCAN The output table is copied from memory to the output chips. These chips then drive the output devices. The input and output scans often confuse the beginner, but they are important. The input scan takes a snapshot of the inputs, and solves