06-02-2021 05:29 AM
Hello!
I'm trying to read pulses from the rotary encoder by using this code but it is showing random garbage values. how can I read values from the encoder by using phases A and B?
Is this necessary to have encoder vi to reading the values from it?
If yes, kindly provide it if you have any. Thanks!
06-02-2021 05:50 AM - edited 06-02-2021 06:03 AM
What you posted seems to be a code to read a potentiometer, not an encoder with AB(Z?) signals, so that might be your problem.
EDIT:
The code you posted is titled "ANALOG pin read example" and uses what seems to be potentiometer hooked up to +5V, GND and a signal line, which is the analog voltage you are (supposed to be) trying to read.
encoder with AB signals would most likely be digital and and would have 2 signal lines (3 if it includes the Z signal) and power lines.
Reading that kind of encoder with a single line analog read would equally result in reading garbage data.
06-02-2021 08:52 AM
Thank you for your info!
Actually, I am trying to use a rotary incremental encoder using LabVIEW & Arduino. can you kindly guide me on how can I control the encoder?
06-06-2021 07:48 AM
You have to use the interrupt pins which they are pin 2 and 3 in Arduino uno. You can use the attached example.
GOOD LUCK
06-07-2021 09:35 AM
Hello!
Thank you for the code.
I did all the things mentioned in the file. I uploaded LIFA on the Arduino compiler. I used pins 2 & 3. During running code on LabVIEW, the encoder was not showing any result on LabVIEW. the count is not increasing or decreasing when I change the position of the encoder.
Kindly tell me how can I resolve this issue. Thank you
06-11-2021 01:51 PM
Hello!
I'm trying to read values from the encoder using this code
I used pins 2 & 3. During running code on LabVIEW, the encoder was not showing any result on LabVIEW. the count is not increasing or decreasing when I rotate the knob of the encoder.
Kindly tell me how can I resolve this issue. Thank you
06-11-2021 02:06 PM
Why aren't you using LINX? LIFA is obsolete and was replaced by LINX.
06-13-2021 04:23 AM
Hi!
can you guide me on how I this LIFA based code into LINX? because it is very difficult to find an encoder block in LINX. Thanks
06-14-2021 07:30 AM
If the encoder pulses are coming quickly then an arduino alone using interrupts on A and B wont keep.
From my experience, you will need to find a suitable quadrature counter chip and interface to it from the arduino using something like SPI or I2C, to periodically poll for the latest count.
Some chips I have seen have the ability to trigger an interrupt line when a certain count is reached. What is the best approach will depend on the application.
0xDEAD