Hey everyone, first post here take it easy on me!
I have been experimenting with the official QEI library (LPC11U24) but I can only get 4 encoders working at once.
Attempt 1 works as expected:
Attempt 1
#include "mbed.h"
#include "USBSerial.h"
#include "QEI.h"
int main() {
//Virtual serial port over USB
USBSerial serial;
//Initialize encoders
//24 Positions per revelution
QEI encoder0(p5, p6, NC, 96, QEI::X4_ENCODING);
QEI encoder1(p7, p8, NC, 96, QEI::X4_ENCODING);
QEI encoder2(p9, p10, NC, 96, QEI::X4_ENCODING);
QEI encoder3(p11, p12, NC, 96, QEI::X4_ENCODING);
//Display Encoder Pulse count
while(1) {
serial.printf("Pulse Count=> e0:%d, e1:%d, e2:%d, e3:%d \r",encoder0.getPulses(),encoder1.getPulses(),encoder2.getPulses(),encoder3.getPulses());
}
}
Attempt 2 also works as expected:
Attempt 2
#include "mbed.h"
#include "USBSerial.h"
#include "QEI.h"
int main() {
//Virtual serial port over USB
USBSerial serial;
//Initialize encoders
//24 Positions per revelution
QEI encoder4(p13, p14, NC, 96, QEI::X4_ENCODING);
QEI encoder5(p15, p16, NC, 96, QEI::X4_ENCODING);
QEI encoder6(p17, p18, NC, 96, QEI::X4_ENCODING);
QEI encoder7(p19, p20, NC, 96, QEI::X4_ENCODING);
//Display Encoder Pulse count
while(1) {
serial.printf("Pulse Count=> e4:%d, e5:%d, e6:%d, e7:%d \r",encoder4.getPulses(),encoder5.getPulses(),encoder6.getPulses(),encoder7.getPulses());
}
}
Attempt 3 compiles and connects, but only encoders 0,1,2 & 3 are working:
Attempt 3
#include "mbed.h"
#include "USBSerial.h"
#include "QEI.h"
int main() {
//Virtual serial port over USB
USBSerial serial;
//Initialize encoders
//24 Positions per revelution
QEI encoder0(p5, p6, NC, 96, QEI::X4_ENCODING);
QEI encoder1(p7, p8, NC, 96, QEI::X4_ENCODING);
QEI encoder2(p9, p10, NC, 96, QEI::X4_ENCODING);
QEI encoder3(p11, p12, NC, 96, QEI::X4_ENCODING);
QEI encoder4(p13, p14, NC, 96, QEI::X4_ENCODING);
QEI encoder5(p15, p16, NC, 96, QEI::X4_ENCODING);
//Display Encoder Pulse count
while(1) {
serial.printf("Pulse Count=> e0:%d, e1:%d, e2:%d, e3:%d, e4:%d, e5:%d \r",encoder0.getPulses(),encoder1.getPulses(),encoder2.getPulses(),encoder3.getPulses(),encoder4.getPulses(),encoder5.getPulses());
}
}
Using X2 Encoding similarly only has encoders 0,1,2 &3 working:
Attempt 4
#include "mbed.h"
#include "USBSerial.h"
#include "QEI.h"
int main() {
//Virtual serial port over USB
USBSerial serial;
//Initialize encoders
//24 Positions per revelution
QEI encoder0(p5, p6, NC, 96, QEI::X2_ENCODING);
QEI encoder1(p7, p8, NC, 96, QEI::X2_ENCODING);
QEI encoder2(p9, p10, NC, 96, QEI::X2_ENCODING);
QEI encoder3(p11, p12, NC, 96, QEI::X2_ENCODING);
QEI encoder4(p13, p14, NC, 96, QEI::X2_ENCODING);
QEI encoder5(p15, p16, NC, 96, QEI::X2_ENCODING);
//Display Encoder Pulse count
while(1) {
serial.printf("Pulse Count=> e0:%d, e1:%d, e2:%d, e3:%d, e4:%d, e5:%d \r",encoder0.getPulses(),encoder1.getPulses(),encoder2.getPulses(),encoder3.getPulses(),encoder4.getPulses(),encoder5.getPulses());
}
}
Now, am I missing something really obvious, if not, is there a way to get around this limitation? Otherwise what is the best way to interface a large number of encoders?
Any help would be greatly appreciated!
Bart
Hey everyone, first post here take it easy on me!
I have been experimenting with the official QEI library (LPC11U24) but I can only get 4 encoders working at once.
Attempt 1 works as expected:
Attempt 1
Attempt 2 also works as expected:
Attempt 2
Attempt 3 compiles and connects, but only encoders 0,1,2 & 3 are working:
Attempt 3
Using X2 Encoding similarly only has encoders 0,1,2 &3 working:
Attempt 4
Now, am I missing something really obvious, if not, is there a way to get around this limitation? Otherwise what is the best way to interface a large number of encoders?
Any help would be greatly appreciated!
Bart