Page 1 of 1

Use input for multiple actions

Posted: 18 Dec 2019, 13:11
by Harry
Hi all,
we want to use an single input to start and stop a process.
The idea would be like this:
- configure input as counter with detecting positive edge
- first press with positive edge will be detected as start
- second press with positive edge will be detected as stop
- value of counter will be read and stored in the beginning
- if change of counter value is detected do appropriate action

1. Question:
Can this kind of behaviour (detecting positive edge) only be done with the counter mechanism or is there another possibility?

2. Question:
in the datasheets of the DIO-Modules is stated that 6 Counters can be used per module. I also read in this forum that only 6 counters can be used in total.
If I have 2 DIO-Modules, can I use 12 counters in total or is this limited by 6 counters as well?

Thanks in advance,
Harry

Re: Use input for multiple actions

Posted: 18 Dec 2019, 17:35
by dirk
Hi Harry, if you remember the last status i.e. with a static variable you can use an usual input. And yes you can use up to 6 counters for each DIO or DI module. You may use up to 10 modules with a RevPi Core 3 and up to 5 Modules with a RevPi Connect.

Re: Use input for multiple actions

Posted: 19 Dec 2019, 13:30
by Harry
Hi Dirk,
thanks for quick reply. Ok, this would be another possibility, thanks.
One more thing:
Is it possible to read out all configured inputs /counters at the same time? With one command? I am just thinking for optimisation and reduce load on the bus... Or do you think this wont be necessary and doest improve anything?
Thanks,
Harry

Re: Use input for multiple actions

Posted: 19 Dec 2019, 23:10
by nicolaiB
Hi Harry,

You could read the whole process image at once from /dev/piControl0 and process each input from the byte structure. When you're for example using the revpimodio2 python library this is already done for you as the inputs are parsed from the whole process image in each cycle loop.

Nicolai

Re: Use input for multiple actions

Posted: 20 Dec 2019, 09:24
by dirk
Thumbs up :)

Re: Use input for multiple actions

Posted: 21 Dec 2019, 14:11
by Harry
Thanks Nicolai, I will have a closer look into the python implementation.

Harry