Skip to Content

NT Command

The NT command (Numeric counTer) allows managing 32 arithmetic counters (accumulators) that can be incremented, decremented and generate triggers when reaching limits.

What is it used for?

  • 🔢 Count events (input activations, reports sent, etc.)
  • 🎯 Trigger actions when reaching a specific value
  • 📊 Accumulate values for statistics
  • Create conditional logic based on counts

Counter Types

IndexTypePersistence
00-15VolatileLost on restart
16-31Non-volatileMaintained after reset

Use counters 16-31 for values that must persist (e.g.: maintenance count).


Syntax

Available operations

OperationCommandDescription
ConfigureSNTaabbbbbDefines the counter maximum
QueryQNTaaReads the current value
IncrementSNTaa+nAdds n to the counter
DecrementSNTaa-nSubtracts n from the counter
ResetSNTaaRSets the counter to 0
MaximizeSNTaaSSets the counter to maximum

Response

RNTaabbbbbccccc

Parameters

ParameterDescriptionRange
aaCounter index00-31
bbbbbConfigured maximum value00000-65535
cccccCurrent counter value00000-65535
nValue to increment/decrement1-65535

NT Signal (Trigger)

The counter generates a trigger on the NT signal when:

ConditionTriggerBehavior
Increment exceeds maximumNT+The counter wraps around
Decrement goes below zeroNT-The counter wraps from maximum

Mathematical formulas:

  • Increment: (value + increment) Mod (maximum + 1)
  • Decrement: ((value - decrement) Mod (maximum + 1)) + (maximum + 1)

Examples

Basic configuration

>SNT0200299< // Configure counter 02 with maximum 299 >SNT02+30< // Increment 30 → value = 30 >SNT02-15< // Decrement 15 → value = 15 >QNT02< // Query: RNT020029900015

Count input activations

// Configure counter 05 with maximum 100 >SNT0500100< // Increment each time IN00 is activated >SRL00E;TRG=IN00+;ACC={SNT05+1}< // Trigger alert when reaching 100 >SRL01E;TRG=NT05+;ACC={GCP00H}<

Trip counter (non-volatile)

// Use counter 20 (persistent) to count trips >SNT2099999< // Increment when ignition turns on >SRL10E;TRG=IN07+;ACC={SNT20+1}<

Complete Demo

>SNT0300299< // Configure counter 03, maximum 299 // RNT030029900000 >SRL00E;TRG=NT03+;ACC={STX TRIGGER}< // Rule: show when it triggers // RRL00E;TRG=NT03+;ACC={STX TRIGGER} >QNT03< // Query: value = 0 // RNT030029900000 >SNT03+1< // Increment → value = 1 // RNT030029900001 >SNT03+100< // Increment → value = 101 // RNT030029900101 >SNT03+200< // Exceeds 299 → triggers NT03+ // RNT030029900001 // Value = (101+200) mod 300 = 1 // RTX TRIGGER // Trigger executed! >SNT03-7< // Decrement → goes below 0 → triggers // RNT030029900294 // Value = 294 // RTX TRIGGER // Trigger executed! >SNT03S< // Set to maximum // RNT030029900299 // Value = 299 >SNT03R< // Reset to zero // RNT030029900000 // Value = 0

Compatibility

💾Firmware:v1.00.00
SP-IOT
SM-IOT
Last updated