The memory functions control binary tags such as outputs or bit memories.
Memory functions exist for assigning, setting, and resetting a binary tag or for evaluating a change in signal state (Table 9.2).
To program a memory function, enter the operation in a line followed by a space and then the operand; in the case of a memory function, enter a binary tag from the operand areas inputs, outputs, bit memories, data, and temporary local data. A bi- nary tag from the bit memory and data areas is ideal for the edge trigger flag. The
O #Fan1.running O #Fan2.running NOT
= #Display.noFan
//Negate RLO
//No fan is running Fig. 9.10 Example of negation of result of logic operation
SET
S #Fan1.drive R #Fan2.drive CLR
CD “Parts_counter”
//Set RLO to “1”
//Fan 1 is switched on //Fan 2 is switched off //Set RLO to “0”
//The internal edge trigger flag for //counting down is reset
Fig. 9.11 Example of setting and resetting the result of logic operation
program editor supports you during input of operands by displaying all suitable, previously programmed tags following input of the first character.
In the same line you can enter a comment, separated by two slashes, up to the end of the line.
9.3.1 Assignment
The assignment directly assigns the result of logic operation to the binary tag named with the operation. The response of the assignment is described in Chapter 12.2.2 “Standard coil, assignment” on page 469.
In Fig. 9.12, the #Display.MinOneFan tag is set to signal state “1” if the operation is fulfilled and to signal state “0” if it is not fulfilled. The result of logic operation is negated by NOT and, together with a further statement, controls the #Display.noFan tag.
9.3.2 Setting and resetting
The set or reset operation is used to assign signal state “1” or “0” to a binary tag in the case of a result of logic operation “1”. A result of logic operation “0” has no ef- fect.
The response of these operations is described in Chapter 12.2.3 “Single setting and resetting” on page 469.
In Fig. 9.13, an AND function comprising #Fan1.enable and #Fan1.start controls the set operation. #Fan1.drive is set to signal state “1” if the AND function is fulfilled, or there is no reaction if the AND function is not fulfilled. The reset operation is con- trolled by an OR function where an AND function with two inputs is connected to its Table 9.2 Memory functions with STL
Operation Operand Function
= Binary tag Assignment of result of logic operation S
R
Binary tag Binary tag
Set to signal state “1” with result of logic operation “1”
Reset to signal state “0” with result of logic operation “1”
FP FN
Edge trigger flag Edge trigger flag
Evaluation of a positive edge of result of logic operation Evaluation of a negative edge of result of logic operation
O #Fan1.running O #Fan2.running
= #Display.MinOneFan NOT
= #Display.noFan
//At least one fan is running //Negate RLO
//No fan is running Fig. 9.12 Example of assignment of result of logic operation
first input. #Fan1.drive is reset to signal state “0” if the operation is fulfilled, or there is no reaction if the operation is not fulfilled. As a result of positioning of the reset operation after the set operation, the memory response is “reset dominant”:
If the logic operations in front of the two operations have signal state “1”,
#Fan1.drive is reset or remains reset.
9.3.3 Edge evaluation
Edge evaluation detects a change in the result of logic operation.
The edge evaluation has the result of logic operation “1” for one processing cycle if the result of logic operation prior to the operation changes from “0” to “1” (FP op- eration, rising edge) or from “1” to “0” (FN operation, falling edge). This “pulse” can be linked further or control a conditional operation.
The edge trigger flag is present next to the edge operation. This is a flag or data bit which saves the “old” signal state of the result of logic operation. The change in sig- nal is recognized by comparing the signal states of the “new” (current) result of logic operation and the edge trigger flag (see also Chapter 12.2.5 “Edge evaluation”
on page 472).
Fig. 9.14 shows an application of edge evaluation. Let us assume that a message has
“arrived”, i.e. the #Alarm_bit signal changes to “1”. The #Alarm_memory tag is then set. The alarm memory can be reset using an #Acknowledge button. The alarm memory remains reset if #Acknowledge has the signal state “0” again and
#Alarm_bit is still present. #Alarm_memory is only set again by a further positive edge of #Alarm_bit (if #Acknowledge then no longer has signal state “1”).
A #Fan1.enable A #Fan1.start
S #Fan1.drive //Switch on fan 1
A #Fan1.enable A #Fan1.stop ON #Fan1.fault
R #Fan1.drive //Switch off fan 1
Fig. 9.13 Example of set and reset operations
A #Alarm_bit
FP #Alarm_bit_Edge_trigger_flag S #Alarm_memory
//Evaluation for positive edge A #Acknowledge
R #Alarm_memory
Fig. 9.14 Example of edge evaluation with STL