Use input for multiple actions

Topics about the Software of Revolution Pi
Post Reply
Harry
Posts: 8
Joined: 15 Dec 2019, 07:42

Use input for multiple actions

Post 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
User avatar
dirk
KUNBUS
Posts: 2174
Joined: 15 Dec 2016, 13:19

Re: Use input for multiple actions

Post 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.
Harry
Posts: 8
Joined: 15 Dec 2019, 07:42

Re: Use input for multiple actions

Post 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
User avatar
nicolaiB
KUNBUS
Posts: 931
Joined: 21 Jun 2018, 10:33
Location: Berlin
Contact:

Re: Use input for multiple actions

Post 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
User avatar
dirk
KUNBUS
Posts: 2174
Joined: 15 Dec 2016, 13:19

Re: Use input for multiple actions

Post by dirk »

Thumbs up :)
Harry
Posts: 8
Joined: 15 Dec 2019, 07:42

Re: Use input for multiple actions

Post by Harry »

Thanks Nicolai, I will have a closer look into the python implementation.

Harry
Post Reply