I try to expand the sample at https://industruino.com/forum/help-1/question/indio-digital-input-interrupt-usage-31 to use one interrupt for two pins.
How would these small comparsion routine look like to have multiple pins with one interrupt?
I tried reading PIN Resgisters but they never seem to change, will i have to use Indio.digitalRead() insteat?
Won't this be "slow" ?
I am using the 32u4 Topboard
If i read PINB - PINF with CH1-8 configured as input with no Voltage on any Chanel, it will look like this:
If i now put Vin on any chanel it looks like this:
The same bit on PINB will change no matter wich chanel i put Vin on !?
Indio.digitalRead() does not work within an interrupt, the programm will stop, if i set a flag within the intterupt routine and use Indio.digitalRead within the main loop that would be just as fast (slow) as polling in the main loop.
Edit2: OK i unterstand why PINB-PINF is useless (ind.i/o channels are set/polled via i2c) But since Indio.digitalRead does not work within an ISR How can i read the status of an Input?
I have the same problem.
The interrupt works, if i only use 1 input. If use more than 1 input, it´s impossible to know which input changed state within the interrupt code. I can do that in the main program, but my program is big, with big cycle times, and I need to count fast digital pulses.
I want to have a counter for each digital input using interrupts, but I think it will be impossible to do. Any suggestion?
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!