DI counter function

Topics about the Hardware of Revolution Pi
BW_BE
Posts: 3
Joined: 30 Aug 2017, 21:24
Answers: 0

DI counter function

Post by BW_BE »

Hi,

We purchased the RevPI Core 3. It works great.
I noticed that you have DI-cards where you can configure the inputs as a counter function. How does it work? Does this card have its own counter controller where we ask/reset the countervalue on request or do we have to do the counting by ourselves in the software? What is the maximum frequency of the counter cards?


Thanks already for your reply.
BW
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41
Answers: 1

Re: DI counter function

Post by volker »

Hi,
our DIO and DI Modules have 14 and 16 input terminals. Using the graphical configuration tool PiCiory (it runs on the integrated Webserver) you can configure each terminal to work as a counter input. The Modules do the counting job for you and our driver PiControl cyclically gets the count value (vie PiBridge bus) into the central process image (32 bit signed values). You can also reset the counters using an ioctl call. As an alternative you can configure a pair of input terminals as A/B inputs of a phase encoder sensor and you will get the encoder count in the process image too.
Count frequency is up to 2 kHz but process image refresh intervall is only 10 to 40 ms depending on the configuration and the bus traffic generated by this system configuration. So if your application needs to use the count as an exact control to start or stop any actuator you should have count frequencies below 25 Hz to get the reaction on the exact count.
Unser RevPi Motto: Don't just claim it - make it!
BW_BE
Posts: 3
Joined: 30 Aug 2017, 21:24
Answers: 0

Re: DI counter function

Post by BW_BE »

Hi Volker,

Thank you for your reply. The counting function works perfect.
Another question: is it possible to stop and restart a counter (enable, disable) by use of phyton script?

Thanks already for your support.
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41
Answers: 1

Re: DI counter function

Post by volker »

Yes, using n ioctl call to piControl can reset any counter. I will try to organize more informatiuon about how to use this ioctl call (parameters etc.)
Unser RevPi Motto: Don't just claim it - make it!
BW_BE
Posts: 3
Joined: 30 Aug 2017, 21:24
Answers: 0

Re: DI counter function

Post by BW_BE »

Hi Volker,

Let me clarify: I'm also interested in resetting the counter but I would like to enable/disable the counter.
E.g. the counter has a value of 308. When I disable the counter, the pulses are ignored as long as the counter is disabled. As soon as I re-enable the counter, the value starts counting from value 308. Is this possible?

Thanks in advance.
Kind regards.
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41
Answers: 1

Re: DI counter function

Post by volker »

Sorry but if I'm not out of date with my information this should not be possible with our ioctl functions at the moment. Please wait until Mathias has explained the ioctl and if it is really not possible with the current driver you could please set this in the Forum "Wunsch- und Ideensammlung" (please feel free to post in English although this is the German part of the Forums).
Unser RevPi Motto: Don't just claim it - make it!
User avatar
Mathias
Posts: 130
Joined: 29 Nov 2016, 10:46
Answers: 0

Re: DI counter function

Post by Mathias »

Hi,
there is an ioctl-call to reset the counters/encoders.
For example, if you use one DI on the right side of the RevPi, it will have the address 32. The address is displayed in pictory.
If you configured Input I_3 and I_4 as counter and want to to reset (set them to 0) them at the same time, you have to make the following call:

SDIOResetCounter tel;
tel.i8uAddress = 32;
tel.i16uBitfield = 0x0c;
ret = ioctl(PiControlHandle_g, KB_DIO_RESET_COUNTER, &tel);

You will find the whole example in the demo-1.zip file in our download area.

It is not possible to stop an continue a counter, all you can do in current version is to reset it.

Please keep in mind that you can use only 6 counters at the same time.

Unforunatlly this is C, not python. I never used python so I cannot help you with that. Maybe you can find an example how to call an ioctl on the page https://revpimodio.org/en/homepage/

Mathias
marioishikawa
Posts: 2
Joined: 17 Dec 2018, 20:04
Answers: 0

Re: DI counter function

Post by marioishikawa »

volker wrote: 30 Aug 2017, 22:37 Hi,
our DIO and DI Modules have 14 and 16 input terminals. Using the graphical configuration tool PiCiory (it runs on the integrated Webserver) you can configure each terminal to work as a counter input. The Modules do the counting job for you and our driver PiControl cyclically gets the count value (vie PiBridge bus) into the central process image (32 bit signed values). You can also reset the counters using an ioctl call. As an alternative you can configure a pair of input terminals as A/B inputs of a phase encoder sensor and you will get the encoder count in the process image too.
Count frequency is up to 2 kHz but process image refresh intervall is only 10 to 40 ms depending on the configuration and the bus traffic generated by this system configuration. So if your application needs to use the count as an exact control to start or stop any actuator you should have count frequencies below 25 Hz to get the reaction on the exact count.
Hi, for 25 Hz as counter, is it still reliable to assume 25 Hz when using all 16 inputs of DI?
Eduard
KUNBUS
Posts: 209
Joined: 18 Jun 2018, 16:16
Answers: 0

Re: DI counter function

Post by Eduard »

Hi,

you can use only 6 counters at the same time.
Therefore 25 Hz are realistic.

Regards,
Eduard
smilykoch
Posts: 4
Joined: 29 Nov 2017, 13:00
Answers: 0

Re: DI counter function

Post by smilykoch »

Eduard wrote: 19 Dec 2018, 10:04 Hi,

you can use only 6 counters at the same time.
Therefore 25 Hz are realistic.

Regards,
Eduard

Is the limitation of 6 counters at a time, still applicable? I do not see any mentions of this limitation in the documentation anywhere?
Post Reply