From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Execution too slow

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.

________________________________________

 

 

0 Kudos
Message 1 of 4
(2,526 Views)

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.

Message 2 of 4
(2,507 Views)

The LINX toolkit should implement a counter. There is some discussion here.

Message 3 of 4
(2,485 Views)

I'll try the LINX, as you both stated this should be done from the Arduino for more speed. 

 

Thx!

0 Kudos
Message 4 of 4
(2,391 Views)