====== CTUD_ULINT ====== {{:en:mervis-ide:35-help:ctud_ulint.png}} ===== Block name ===== CTUD_ULINT ===== ST call ===== PROGRAM CTUD_ULINT_DEMO VAR BOOL1,BOOL2,BOOL3,BOOL4,BOOL5,BOOL6: BOOL; ULINT1,ULINT2: ULINT; FB:CTUD_ULINT; END_VAR FB(CU:=BOOL1,CD:=BOOL2,R:=BOOL3,LD:=BOOL4,PV:=ULINT1,QU=>BOOL5,QD=>BOOL6,CV=>ULINT2); END_PROGRAM ===== Description ===== The block is an up and down counter. If both //r// and //ld// are //true//, //r// has higher priority. ===== Inputs ===== |Input|Type |Description |Default value| |CU |BOOL |Adds 1 on rising edge |False | |CD |BOOL |Subtracts 1 on rising edge |False | |R |BOOL |Reset to zero |False | |LD |BOOL |Sets the counter to the maximum value|False | |PV |ULINT|Maximum counter value |0 | ===== Outputs ===== |Output|Type |Description | |QU |BOOL |Status when the counter reaches its maximum value| |QD |BOOL |Status when the counter is zero | |CV |ULINT|Current counter value | ===== Application example ===== {{:en:mervis-ide:35-help:ctud_ulint_example.png}}