Count('Expression','Level'=0.5,'Hysteresis'=0,'EdgeType'=1,'Reset'=FALSE)
Arguments
|
'Expression' |
Signal or expression |
|
|
'Level' |
Specification of the level value |
|
|
'Hysteresis' |
Specification of a hysteresis band |
|
|
'EdgeType' |
Edge type to be counted |
|
|
'EdgeType' <0 |
only falling edges (leaving out hysteresis band in the negative direction) |
|
|
'EdgeType' >0 |
only rising edges (leaving out hysteresis band in the positive direction) |
|
|
'EdgeType' = 0 |
falling and rising edges |
|
|
'Reset' |
Optional binary parameter to reset the counter. 'Reset' can be an expression as well. |
|
|
'Reset'=TRUE |
Counter is reset. |
|
|
'Reset'=FALSE |
Counter value is retained/continues to count. (default) |
|
Note |
|
|---|---|
|
The 'Reset' condition must not refer to the Count function itself. |
|
Description
The function counts the crossings of 'Expression' through 'Level'.
You can use the 'Hysteresis' parameter to define a tolerance band that is above and below 'Level' by equal amounts. Only complete crossings through the tolerance band are counted.
The 'EdgeType' parameter determines which kind of edges are counted. The 'Reset' parameter is used to reset the counter value to 0. You can also formulate 'Reset' as an expression.
Tip |
|
|---|---|
|
You can also use the Count function for digital signals. For this purpose, choose 0.5 for 'Level' and, for example, 0.1 for 'Hysteresis'. By this all changes from FALSE to TRUE and vice versa will be detected and counted. |
|
Example
Specification:
-
'Level': 2.5
-
'Hysteresis': 2.0
Result:
When using hysteresis, level crossings in the ascending direction are not counted until 'Expression' is > 3.5 and in the descending direction until 'Expression' is < 1.5.
