N ORMAL A CTIONS

N ORMAL A CTIONS

Normal actions , also called nonstored actions, incorporate IEC 1131-3 language instructions that are executed continuously during the activity of a step. In other words, the instructions within a normal action will be executed and scanned over and over until the step is deactivated (see Figure 10-73). The basic syntax for a normal instruction is shown in Figure 10-74, where (N) indicates normal. Normal actions may also omit the (N) parameter in the instruction syntax.

Step Activity

Normal Action 1 Execution 0

Multiple execution of the normal/nonstored action during the active step

Figure 10-73. Execution of a normal action.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC The IEC 1131 Standard and C HAPTER 3 Programming

Programming Language 10

10 (Normal_Action_Ex) Action (N):

• 11 End_Action;

Figure 10-74. Syntax for a normal action.

Figure 10-75 shows an example of a counting program using a normal action in step 2. Note that step 1 uses a pulse action to set the value of the variable R_Count to zero. As the next example illustrates, the normal action in step

2 (programmed using ST language) performs a counting procedure on the rising edge of the signal Cmd (command) and stores the total count value as variable R_Count. This counting procedure is executed for as long as step 2 is active.

1 (Initialize) Action (P):

R_Count:=0; End_Action;

1 Start_Counting

2 (Count_Step) Action (N):

If Cmd_Cnt AND NOT (Last_Cmd) Then R_Count:=R_Count+1; End_If; Last_Cmd:=Cmd_Cnt;

End_Action; 2 Stop_Counting

Figure 10-75. Example of a counting program using a normal action.

E X AM PLE 1 0 -7

Referring to Figure 10-75, explain the operation of step 2. Also, draw a timing diagram of the signals indicating when the counter variable R_Count begins and ends during each count.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC The IEC 1131 Standard and C HAPTER 3 Programming

Programming Language 10

S OLU T I ON

Figure 10-76 illustrates the timing diagram of step 2. The variable R_Count increases its value by one every time the signal Cmd_Cnt goes from OFF to ON. The IF condition in step 2 of Figure 10-75 ensures that the signal is tested to make sure that it has gone OFF after the OFF-to-ON transition. The Last_Cmd:=Cmd_Cnt instruction traps the last value of Cmd_Cnt, so that the count does not get executed again without Cmd_Cnt going OFF first. When the action is deactivated by the Stop_Counting transition variable, the status of Cmd_Cnt and Last_Cmd are reset to OFF (not stored). Note that the R_Count value is reset to zero at step 1. However, the value of R_Count will be stored as a normal integer value in the program until it is changed, as in this example, in step 1.

Start_ Counting

X2

Stop_Counting

Cmd_Cnt

Last_Cmd

R_Count

End of 1st Count R_Count = 1

End of 2nd Count R_Count = 2

Beginning of 1st Count Beginning of 2nd Count

Figure 10-76. Timing diagram of step 2 in Figure 10-75.