From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-21-2017 12:22 PM
Hello All,
I am having some trouble setting up an encoder in labview and getting an output. My labview skills are weak at best. I have a PCI-6259 and a quad encoder wired into the counter 0 terminals of the SCB. I set up some Boolean indicators on the channels to make sure I am getting my pulses (which I am). I tried using the DAQmx VIs like I saw in some examples but kept getting errors. I tried using the DAQ Assistant to set it for angular postion but I wasn't getting any output when I ran it.
02-21-2017 02:18 PM
I'm not sure, that this is the problem source, but you have Acquisition Mode set to 1 Sample. Try to change it to multisampling...
02-21-2017 02:42 PM
I did try that, but it errors out because it needs some sort of clock input to use as a reference. I tried to create one but I couldn't get that to function properly.
02-21-2017 03:56 PM
Try to read very basics of DAQmx, try to open LabVIEW examples (search quadrature encoder).
Right now you are saying "my program gives some errors. I have tried some examples, they do not work".
By a screenshot of the block diagram with express VIs I can only say that you are probably trying to read from the same lines simultaneously and getting conflict.
PS. If you use ALT+ printscreen, it will capture only one window. If you use command Edit -> Create VI snippet from selection on blockdiagram, we will be able to open this snippet and see how everything is configured. Guess what is more informative?
03-13-2017 05:33 AM - edited 03-13-2017 05:38 AM
I had to work on some other projects, but I am back on this now.
I managed to get the encoder setup and reading correctly.
The only thing I can't figure out now is how to reset the counter to zero with the software.
Using the z-channel would not work for my application.
It seems like I am going to have to stop and then re-start that portion of the program unless there is another way?
03-13-2017 11:13 PM
Josh@bpe wrote:I managed to get the encoder setup and reading correctly.
The only thing I can't figure out now is how to reset the counter to zero with the software.
Using the z-channel would not work for my application.
Why won't the z-channel work? Do you mean you can't get LabVIEW to recognise it, or that the z-channel is unsuitable for some physical reason? (As a possible side note, are you sure X1 is the right decoding type?)
It seems like I am going to have to stop and then re-start that portion of the program unless there is another way?
It seems extremely unlikely that that will be your only choice. LabVIEW is pretty flexible (sometimes too much, and encoders seem to be a pain...)
03-14-2017 07:09 AM
Channel Z works fine. When I enable it, the encoder will reset to zero when it passes that point. However, the application I am using it for has technicians installing it onto various valves to measure the opening angles. Using the Z channel would not be practical for this application. But I was able to solve my dilemma yesterday. Here is a pic of the code. I basically use a couple local variables, one to store the position of the encoder when the reset button is pressed and one of the position of the encoder and then subtract the 2 values.
03-14-2017 07:18 AM
Hi Josh,
I basically use a couple local variables, one to store the position of the encoder when the reset button is pressed and one of the position of the encoder and then subtract the 2 values.
Why don't you use a shift register to store the position (on reset button)?
Why don't you get rid of the other one and use a simple wire instead?
THINK DATAFLOW!
03-14-2017 07:25 AM
The thought had crossed my mind but I don't have much experience with shift registers and don't have a lot of time to 'play' with Labview at the moment. I will look into it more when I get some time free'd up. Thanks.