10-06-2010 05:28 PM
Hi All,
I have an existing LabVIEW program that uses three counters to measure A, B and Z signals of the encoder. I can read these signals separately if I hook only one of them to the PCI 6602. If I hook up A and B, I will get intermitten correct reading for signal A. I will always get the correct reading for signal B. Is there a problem of trying to measure these signals using separate counters? This program basically tries to measure the time between the different edges. There isn't any documentation, so I am not even sure which board this application was written for. Although, there is an analog input section of this code. I even tried the counter for the 6502E board. I get the same problem. I am not sure if the physical channels constants in the program is correct. Has anyone run into this problem before?
Thank you for your input.
10-07-2010 05:23 PM
Hello Van626,
After looking over your code for measuring a encoder, I would suggest performing this acquistion in a different way. The reason why is that it is not advisable to create and clear or start and stop in a while loop. In order to get around this, here are some ideas I had:
1.) Use the Counter Input Angular Encoder Task. This task will allow you to record the encoder measurements so that you don't have to program this yourself. I would suggest starting with Measure Angular Position.vi example in LabVIEW. In order to specify the PFI lines for the A, B, Z terminals, there is a channel property node under Counter Input » Encoder for A, B, and Z terminals.
2.) If you want to record each signal, you have enough counters to do this. There is a VI called DAQmx Connect Terminals that will connect PFI lines together. In doing this, you can connect your three signals to three PFI lines but have them go to multiple counters. I have current tested this with an Angular Encoder task with a Two edge Separation and it works perfectly
Note: You will need to look at the Device Routes for the PCI-6602 to ensure that you are sending the signal to the correct place. Another caveat about connecting PFI lines together you will have to disconnect them when you are done. If you don't they will always be connected. This can be done by reseting the device using the DAQmx Reset Device.vi or the DAQmx Disconnect Terminals.
10-08-2010 05:29 PM
Hello Jim,
Thank you for replying to my post. I have thought about doing it that way also. The thing is that this program was already written before. At the moment, I am trying to make it work as designed. After I figure out what is going on, I will also try doing the encoder testing as you suggested. Presently I was able to find the pw and 2-edge sep. for lines A and B. But not able to find the pw for the Z line. I found out that ctr 0-2 was not working or not very well together.
What do you mean by connecting all three PFI lines together? For the sep. measurement, I connect A and B to one counter and use one more counter to measure pw of A. In any case, I will try out your suggestion. I like to find out what these daqmx vis do.
You are right, I also noticed that these tasks are started and cleared repeatedly. I have already fixed one program that did the same thing. Thank you again for your help. I will try out everything you suggested.
Van626
10-11-2010 02:43 PM
Hello Van626,
When I said connecting PFIs line together to send the signals to multiple counters, I think it would be best explained by providing an example.
Let's say that you wanted to perform 2 counter measurements, encoder and edge separation between A and B, and you have connected your three signals to PFI 0 , PFI 1, and PFI 2. Unfortunately two counters can't use the same PFI when performing measurements. There are 2 possible solutions: physical wire the signal to another PFI line or connect them pragmatically in LabVIEW. Usually it isn't desirable to physical wire them together because of the extra wiring and the possibility of increasing noise of the signal. The DAQmx Connect Terminals allows you to connect these PFI lines on the board itself. I have create a image that illustrates this functionality.
I hope this helps with explaining that functionality. If you have any more questions, feel free to post
10-11-2010 03:05 PM
Hello Van626,
After looking into this further, I misspoke about the PFI lines. You CAN use a PFI for multiple counter tasks so you don't have to route them manually. Sorry for the confusion about this. I would suggest not routing them manually because of extra complexity it would add to your code.
As for the example, I would like to clarify parts of it. The PFI lines I mentioned would not connect to each other with your card. I used these example instead of the PFI lines that would work for you card for simplify the example. In order to find which PFI lines that will connect together, please consult the device routes in MAX for this information.
Again, sorry for the confusion and I hope this information helps you.
10-12-2010 03:23 PM
Thank you for the reply Jim. I will test out your suggestion soon. I plan to troubleshoot the original software and try to do an encoder vi for a straight forward solution.
Van626
02-28-2011 01:02 AM
hey..i have similar case as yours.
my question is do u mind sharing your program to me?
i need to count pulse A and Pulse B, also need to find the difference (TIME) in milisecond between those two pulses
i'd really really appreciate if you would share it with me
02-28-2011 03:24 PM
Hi Amirul,
I am enclosing the zip file of the project I worked on. There is the initialize case
where everything is set up for the daqmx. This case pretty much tells how
all daq will operate throughout the program. Let me know if you could
get it to work out.
Good Luck.
02-28-2011 06:08 PM
thanks for sharing, but actually Ive been using different hardware
Im using NI SCOPE PCI5102 and currently havent found any solution to measure time difference between pulse A and Pulse B
do you have any other suggestion or solution? im also newbies in labview.., perhaps you can show me how
Thank you very much
03-01-2011 11:05 AM
Hi Amirul,
I am not familiar with PCI 5102. It seems to be like a scope hardware.
I would start with the examples that shipped with LabVIEW. I think
if you look under Analyzing and Processing Signals/Pulse and Transition Measurements,
there might be something that would measure the signal edges.
You can try the forums and examples on NI. It might take some time
but I think you will find something. There are a lot of vis for signal processing
also. It sounds like an interesting project.
Good Luck.