PLCcheck

S5 AWL Command: ZV (Count Up)

S5 AWL instruction ZV (Count Up): Increments a counter by 1 on each rising edge of the VKE. Counter range 0–999 (BCD).

·3 min read
S5AWLZVcountercount upCTUBCDZähler

Diesen Artikel auf Deutsch lesen

S5 AWL Command: ZV (Count Up)

ZV increments a counter by 1 on each rising edge of the VKE. The counter value is stored in BCD format with a range of 0–999.

Syntax

U   E 0.0          // Count pulse input
ZV  Z n            // Increment counter n

To set a preset value:

U   E 0.1          // Set condition
L   KZ 050         // Preset value = 50
S   Z 1            // Set counter Z1 to 50

S7 Equivalent

S5 AWLS7 FunctionIEC 61131-3
ZVS_CUCTU (Count Up)

Code Example — Parts Counter

U   E 0.0          // Sensor detects part
ZV  Z 1            // Count up

U   E 0.1          // Reset button
L   KZ 000         // Preset = 0
S   Z 1            // Reset counter to 0

L   Z 1            // Load current count value into ACCU1
T   MW 10          // Store count in MW10 for display

Reading Counter Values


Part of the S5 AWL Command Reference. Maintained by PLCcheck.ai.


Analyze Your S5 Code Automatically

PLCcheck Pro reads your complete S5 AWL program and explains every instruction — including this one — in plain language. Upload your code and get instant documentation, S7 equivalents, and migration guidance.

Upload S5 code for free analysis → | S5→S7 Migration Guide →

Related Articles

Analyze your PLC code with AI

PLCcheck Pro explains, documents, optimizes, and migrates PLC code — automatically.

Try PLCcheck Pro →
← Back to Blog

Not affiliated with Siemens AG. S5, S7, STEP 5, STEP 7, and TIA Portal are trademarks of Siemens AG.