05-09-2018 03:40 AM
Hi, I too am facing a similar problem,I tested my encoder using simple Arduino code and its working fine,In Labview its kind of lagging or say labview arduino interface is quite unable to keep up with the pace.Still i managed to run the basic version of the code successfully.The bigger problem arises when i try to run the code in a complex program.It just doesn't work .Can somebody please review my code and help me out.I have attached codes for the simpler as well as the complex programs
05-09-2018 03:47 AM
Hi Vijay,
your smaller VI runs the LIFA part as fast as possible, but the MajorProject puts a 100ms wait function in the loop and runs IMAQ code in the very same loop. No wonder the LIFA part executes slower…
Use parallel running loops to process LIFA and IMAQ independently!
05-09-2018 02:47 PM
The problem occurs even when i assign 1ms wait on both files.Sorry that i didnt mention this earlier in my post.But yeah,let me try with parallel loops.Thank you for your help.BTW the process is not slow in case of majorproject.vi it is actually faulty i.e the encoder doesn't increment the counter in a proper manner when rotated(it doesn't go beyond 2 and sometimes decreases when it is supposed to increase)
05-09-2018 03:01 PM - edited 05-09-2018 03:02 PM
Hi Vijay,
are you sure your "encoder decoding" code is working the way you expect it to work?
You read pin6 and sometime later you read pin7. For a "good" AB(Z) encoder you need to read both pins at the same time!
(By the time you read pin7 the encoder might have moved further so the comparison of pin7 with pin6 may fail.)
I don't use LIFA but is there no encoder reading function? Can you implement the encoder counting part using the Arduino IDE and transfer just the encoder counter using serial communication?
Btw. clean up your code (even AutoCleanup will do) and NEVER hide the labels of control/indicator terminals in the block diagram…