Hi,
The circuit is interesting. I think what i would have done though is i would have just made one port go to high impedance when it wasnt needed. That would make resistor selection much simpler.
.
How would your circuit look like in that case?
if (INTCON3bits.INT3IF) { // motor QEI input
INTCON3bits.INT3IF = LOW;
if (TMR4 > V.qei_counts) V.qei_counts = TMR4; // if timer4 is not 0 then update
TMR4 = 0; // reset the timer to zero
T4CONbits.TMR4ON = 1; // start the timer if stopped
V.b3++;
// not a very good position counter, relies on a 1/16 A channel hardware divider and a B channel logic level latch
LATJ = LATJ | 0b00001111; // clear diag 0..3 leds on PORTJ
DLED_3 = ON;
qei1.ticks = 0;
if (QEI1_B) {
--qei1.c;
qei1.cw = TRUE;
DLED_1=ON;
} else {
++qei1.c;
qei1.cw = FALSE;
DLED_0=ON;
}
if (QHOME) qei1.home = TRUE;
if (QBACK) qei1.back_stop = TRUE;
if (QFORWARD) qei1.forward_stop = TRUE;
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?