Okay. I appreciate your time in reading what I post and helping me out. I have already mentioned that there are two motors. So two encoders. So 2 pairs of ABI signals.
So whatever ISRs I have explained just duplicated for the second motor.
To sum it up
For the Bottom Motor:
DoEncoderABot() is triggered by the 'A' signal from the encoder, checks if DoEncoderBBot() (i.e by the B signal) was triggered before it. If yes, which meant we are moving in the forward direction, increment the counter. Else decrement the counter.
DoEncoderBBot() is triggered by the 'B' signal from the encoder, checks if DoEncoderABot() (i.e by the A signal) was triggered before it. If yes, which meant we are moving in the forward direction, increment the counter. Else decrement the counter.
DoEncoderIBot() is triggered by the 'I' signal from the encoder. It measures the timestamp it was triggered, and the difference between two timestamps helps me get the RPM. This ISR outputs the time difference.
All these ISRs are duplicated for the Top motor.
so we have
with the same functionality as mentioned above.
On a side note,why is everyone so sarcastic over here? I am no expert, not even close, I'm here to learn and sought out help because I cannot figure out what's wrong and I might've overlooked things in my code. Hell I might've even written crappy code that might have people laugh, but constructive criticism is always welcome :)