Paul,
This is the issue we discussed earlier today. I purchased the Teensy 3 to read encoders. I have tried unsuccessfully to do this with the ATmega 328 16mHz chip and was not able to keep up with the encoder speed even using the PORT registers. I assumed the faster chip on the Teensy 3 would solve the problem. I have tried this same process on the Teensy 3 using hardware interrupts, the encoder library and direct pin reads (well, as direct as I can get using digitalReadFast). I am only attaching the library method (and associated output) to avoid confusing the issue.
Actually the counts returned by digitalReadFast seem to be closest although they are still short. I have tried this with 6 different encoders across 2 brands: US Digital and CUI. The encoder I am using for the test program (attached) is a CUI MT102-V 2048ppr encoder (http://www.cui.com/product/resource/amt10x.pdf), driven at ~200RPM. The encoder, gearmotor and motor controller I am using for this test have tested successfully in a prior application (using a quadrature decoder) so I know they are capable of doing what I need to do.
I appreciate any light you can shed on this problem.
Will
Attachments: sample program, sample output
This is the issue we discussed earlier today. I purchased the Teensy 3 to read encoders. I have tried unsuccessfully to do this with the ATmega 328 16mHz chip and was not able to keep up with the encoder speed even using the PORT registers. I assumed the faster chip on the Teensy 3 would solve the problem. I have tried this same process on the Teensy 3 using hardware interrupts, the encoder library and direct pin reads (well, as direct as I can get using digitalReadFast). I am only attaching the library method (and associated output) to avoid confusing the issue.
Actually the counts returned by digitalReadFast seem to be closest although they are still short. I have tried this with 6 different encoders across 2 brands: US Digital and CUI. The encoder I am using for the test program (attached) is a CUI MT102-V 2048ppr encoder (http://www.cui.com/product/resource/amt10x.pdf), driven at ~200RPM. The encoder, gearmotor and motor controller I am using for this test have tested successfully in a prior application (using a quadrature decoder) so I know they are capable of doing what I need to do.
I appreciate any light you can shed on this problem.
Will
Attachments: sample program, sample output