Counter synchronisation

Topics about the Hardware of Revolution Pi
Post Reply
alexsf
Posts: 2
Joined: 10 Aug 2023, 15:33

Counter synchronisation

Post by alexsf »

I'd like to use the DI module to count pulses from two devices at the same time. I don't think it is critical that I start counting at a particular moment but it is very important that the two counters are synchronised so that they both start counting at the same time.

I can't find anywhere how the counters work and whether this is possible. Can anyone tell me?

Thanks
kjkoster
Posts: 87
Joined: 12 Feb 2022, 10:42

Re: Counter synchronisation

Post by kjkoster »

Dear Alexsf,

Is it not heaps easier to just do that in software? As you the system boots, you read both counters at the same time and store that as the offset. Then each cycle you read both counters at the same time, subtract the offset and you have clean, reliable counts since boot.

Kees Jan
alexsf
Posts: 2
Joined: 10 Aug 2023, 15:33

Re: Counter synchronisation

Post by alexsf »

Thanks for the reply, yes this could be a way to do it but a similar question applies then, how synchronised are the channels when the counters are read?

You can imagine that if I'm counting 1.5kHz pulses and I read two counters but the reads of the hardware are off by 10ms then that's a 15 count error which may or may not be acceptable for the application. I think for our application we may be able to cope with less well synchronised counting than I initially thought but I would like to know what is achievable so I can work out what sort of errors I can expect due to this.
kjkoster
Posts: 87
Joined: 12 Feb 2022, 10:42

Re: Counter synchronisation

Post by kjkoster »

Dear Alexsf,

That I do not know, though I am curious to learn. I guess we'll have to wait what one of the Kunbus experts has to say on the topic.

Kees Jan
Post Reply