09-28-2014 06:01 AM
Hi!
I want to read pulses from a Rotary Encoder that I've connected to an Arduino. I've got the the VI to read and count pulses but if I turn the knob (on the Rotary Encoder) too fast than the VI would miss a lot of pulses.
Anybody have an idea how I can fix this? Or speed up my VI execution?
[VI is attached]
__________Explanation for the VI_____________
Reading a digital pin (where the Rotary Encoder Output is connected with an pullup resistor). When the pin goes from 0 --> 1, add one to the count.
________________________________________
09-28-2014 08:04 AM
It is not your vi that is the problem.
You need to understand what you are doing.
Your problem is the way data is transmitted from the Arduino.
The LIFA transmit the value of the port using serial connection. Serial connection is not the fastest way to transmit data.
It is also setup as an ask reply protocol, that takes time.
To be able to handle a Rotary encoder correct, you need to program the Arduino directly.
For it to be fast enough to detect a pin change, you need to read the pin very fast or use the Arduinos interrupt.
That can only be done while programming the Arduino.
09-28-2014 11:11 AM
The LINX toolkit should implement a counter. There is some discussion here.
10-05-2014 04:16 AM
I'll try the LINX, as you both stated this should be done from the Arduino for more speed.
Thx!