PB IoT Command — Pulse Burst Counter
PB counts the pulses of a burst on an input and delivers the raw number. It is used to read devices that encode a value as a number of pulses: blink codes from dashboards and ECUs, controllers that emit fault codes by count, key gestures.
The design is deliberately agnostic: the device counts, the server interprets — the meaning of each count is mapped by the platform.
Available since firmware v1.09.25 (SPIDER/SMART; on ZERO it answers RPB NA).
How does it work?
- Each edge on the port (after the debounce) adds one pulse to the burst in progress.
- When the gap of silence elapses, the burst is closed.
- The parity and range filters are applied: if they do not pass, the count is discarded without touching anything (they work as an implicit checksum).
- The accepted count stays in
QPBand fires thePBsignal of the event engine.
gap = 0 means PB off (factory default). PB coexists with PC and FC on the same port, with no exclusive mode.
Commands
Configure in one line
>SPB00,200,20,1,2,32< // gap 200 ms, debounce 20 ms, even only, range 2-32
>RPB00,200,20,1,2,32,0,0<The fields are incremental: the ones you omit keep their value. The response to SPB is always the resulting QPB — and the response can be copied back as a set (the two trailing status fields are ignored).
Individual adjustments
>SPB00G200< // closing gap in ms (0 = turn PB off)
>SPB00D20< // debounce in ms
>SPB00P1< // parity: 0=any, 1=even, 2=odd
>SPB00R2,32< // accepted range (0,0 = no limit)
>SPB00Z< // resets count/sequence (the config stays)Query
>QPB00<
>RPB00,200,20,1,2,32,8,3< // last burst: 8 pulses, sequence 3Factory defaults: gap 0 (off), debounce 20 ms, parity 0, range 0,0. Everything persists in NVS; the count and the sequence do not (they are lost on reboot).
In the event engine and EVAL
PBsignal with index:>SRLA0E;TRG=PB00+;ACC={...}<— it fires when an accepted burst is closed.MPB(puerto;campo)function in EVAL:MPB(0;0)= last accepted countMPB(0;1)= sequence number (to deduplicate on the server)MPB(0;2)= seconds since the last burst (data freshness)
In EVAL the arguments are separated with a semicolon: MPB(0;0). Writing MPB(0,0) gives an error — the comma is the report field separator.
Typical report: a UC template with $MPB(0;0)|,|$MPB(0;1) fired by the PB00 signal, and the server deduplicates by sequence and maps the meaning of the count.
Compatibility
On a port with PB active it is best to leave the FC window at 0: the FC window reinstalls the interrupt and can lose an edge mid-burst.
See Also
- PC Command - Continuous pulse counters
- FC Command - Frequency per window
- EVAL Command - Expressions with MPB