Hey Together,
I started a Project where I need to read in 7 Digital Encoders, each with 2 Channels (Differential).
I found the Arduino Nano Every and was quite thrilled that all Digital Pins are capable of Interrupts. [attachInterrupt() - Arduino-Referenz]
I built up a the prototype using LM393n Comparators for the differential Signal and Pull-Up's to Vcc to get "0V" or roundabout "5V" from each channel(Arduino input threshold supposedly is 3.5V so we should be golden on this front). I tested every Channel with my picoscope and it seems to work like a charm. Basic sketch of each channel in appendix
From a Sofware point of view this principle works also well on the native "Digital-Only Pins" (D2-D12). Here I get my interrupts while moving my encoders, and the system is quite when not.
It does not work on "Analog and Digital Pins" (D14-D17). Here interrupt is constantly triggered. Even when I pull the Pin down to GND. If I disable the Pin 19 the same problem occurs on pin 20. I think I simply don't grasp how to use the Pins properly. But I also can't find a good fix.
I tried to use the "MegaCoreX-Lib" and use those Analog inputs as comparators themselves. But no luck there. It just trows out more issues. (Also it's quite unpretty to look at codewise)
I Put my code last coz It's probably just caused by my wrong understanding of the pins. I put a snippit here. Code is the same for all Pins.
pinMode(19, INPUT);
attachInterrupt(digitalPinToInterrupt(19), interruptFunction, Change);
//Other Stuff
void interruptFunction(){
if(Enc_X_Ch_A_isLeading){
counterEncX++;
}
else{
counterEncX--;
}
}
so I hope this Post contains anything thats needed. I am happy to provide more Info if needed.
thanks for your time and help!
cheers!
Kevin