Which sketch is in your emonTx? Is it the default, if so when did you get it?
If it’s using emonLibCM, then the pulse count is as documented:
unsigned long EmonLibCM_getPulseCount( )
Returns the accumulated count of pulses since the library was initialised, provided that
pulse counting has been enabled.
The earlier DS sketch worked similarly (but you’d only know by looking at the source code - this is done just prior to reporting the values every 10 s or so. pulseCount is the count since the last report):
if (pulseCount) // if the ISR has counted some pulses, update the total count
{
cli();
emontx.pulseCount += pulseCount;
pulseCount = 0;
sei();
}
(If you’ve picked up the “debug” print statements, it’s done after those, so it’s one report late.)
It looks as if it picked up a spurious one somewhere - if it’s not incrementing. If it is, you have a pick-up/interference problem.
If you’re not using the pulse input, disable it in the sketch.
I’ve just fired up the “max” demo sketch and that reports 0 pulses, as does Trystan’s “src.ino” (aka ‘emonTxV3.4 Continuous Sampling’) sketch.
emontx.pulseCount is the “all-time” accumulated count. That should be the value you’re sending to your PiZW.
Solved it. I was being lazy and not powering down the TX but just plugging the Pi in. If I power down the TX and restart it (and therefore the Pi), Pulse is zero.