The function analyzes a variable of the type DWORD and outputs how often a 1-0 sequence (falling edge) occurs in the variable.
LGF_CountFalInDWord
in the future!LGF_CountFalInDWord (FC) | ||||||||
---|---|---|---|---|---|---|---|---|
DWord | dWordActCycle | Ret_Val | Int | |||||
DWord | dWordPrevCycle | |||||||
Identifier | Data type | Description |
---|---|---|
dWordActCycle | DWord | Input Double word in which the falling edges are counted |
dWordPrevCycle | DWord | Double word from the previous cycle |
Identifier | Data type | Description |
---|---|---|
Ret_Val | Int | Number of falling edges in the DWord |
In a variable of the data type DWORD, the block counts the falling edges (1-0 transitions) from left to right. The output countFalInDWord
outputs the number of falling edges.
So that falling edges at the variable limit are also detected, the input value
is copied to the static variable statDWordPrevCycle
at the end of the evaluation and evaluated in the next cycle.
####### Example
The following example illustrates the block’s functionality. In this case, it is assumed that a signal of unknown length is continuously sampled in the form of double words (DWORD) per cycle.
Within this signal, the 1-0 sequences (falling edges) must be counted and output continuously. To detect the falling edge on variable limits, as in this example, the input “statDWordPrevCycle” must be interconnected with the double word of the previous sampling.
Table: Example
DWord previous cycle
statDWordPrevCycle |
DWord actual cycle
value |
---|---|
1001_0000_0001_1010_1001_0000_0001_1011 | 0010_1010_0001_1111_0100_0011_1000_0101 |
Number of 1-0 sequences (falling edges): Ret_Val
= 8
####### Application example
Excerpt from the manual of the technology module TM Timer DIDQ 16x24V:
With the oversampling function, the technology module records the state of the respective digital input per application cycle (e.g. OB61) at 32 points in time with a uniform time interval. The 32 states are jointly returned as 32-bit values in the checkback interface.
Figure: Example of an oversampling of DI0 on TM Timer DIDQ 16x24V
The LGF_CountFalInDWord block is used, in this case, to count how often a falling edge occurs.
SIMATIC ET 200MP/S7-1500 Technology Module TM Timer DIDQ 16x24V
(6ES7552-1AA00-0AB0)
https://support.industry.siemens.com/cs/ww/en/view/95153313
Version & Date | Change description | |
---|---|---|
01.00.00 | Siemens Industry Online Support | |
19.08.2015 | First released version | |
01.00.01 | Siemens Industry Online Support | |
02.01.2017 | Upgrade: TIA V14 Update 1 | |
01.00.02 | Siemens Industry Online Support | |
17.08.2018 | Upgrade: TIA V15 Update 2 | |
01.00.03 | Siemens Industry Online Support | |
23.11.2018 | Upgrade: TIA V15.1 | |
03.00.01 | Simatic Systems Support | |
12.11.2020 | Insert documentation and LEGACY Hint Please use the FB with the same name `LGF_CountFalInDWord` in the future |