02-24-2011 03:19 PM
I am trying to use the Z-Indexing function on the DAQmx Counter along with the reference marks on a linear encoder to be able to determine Absolute Position.
I have a PCIe-6320 DAQ card which has 4 Quatrature Counters each hooked to a linear encoder through the SB-68 Breakout box.
One of the encoders I am using is the SENC150 which has 2 reference marks every 20mm (but not exactly 10mm). The spacing of the reference marks are "random" so that once you characterize the spacing on a given encoder, once you find any two marks, you should be able to tell where you are on the encoder.
I am able to get relative position with the Z-Index disabled and if I enable it with the phase setting A High B High, it does reset to the Z Index Value every approx 10 mm so I am confident it is wired correctly.
My question is can I use the Z-Index pulses to determine absolute position without having to use an additional counter task since I have used them all?
Perhaps more generally, if not this, what is the purpose of the Z-index function on linear encoders? Is this just a carry over from angular? I have found quite a few examples and threads concerning the Z-Index in reference to angular encoders, but very few if any having to do with Linear position encoders.
Any suggestions?
02-25-2011 11:23 AM
I couldn't find any information on the Position-Trac feature, but the z-pulse on a linear encoder would be used the same way as a z-pulse on a rotary encoder. It provides accurate referencing. A typical homing procedure would be finding the edge of a switch, then find the z-pulse. The switch is used for rough referencing, and the z-pulse is used for final referencing.
02-25-2011 04:05 PM
OK. That makes sense, but how do you monitor the Z-Index pulse using the Counter task? Do you manipulate the Z-Index Enable and the Z-index value properties? I haven't been able to change the Z-Index properties of the DAQmx Counter task without stopping the task and starting it up again so how do you do that while the encoder is moving without missing counts?
Is there an example of this so I can see how this would be handled in Labview?
02-26-2011 06:19 AM
Take a look at this: http://zone.ni.com/devzone/cda/epd/p/id/5737
02-28-2011 09:01 AM
Highland, I really appreciate your taking your time to try to help me, I really do, but at the same time, please don't waste my time. The example you gave me is the most basic linear encoder example possible. I have some experience with the DAQmx in general. My application has 4 quadrature linear encoders running simultaniously with processing on each along with 3 ea. analog signals from strain gages.
You had suggested using the Z-Index in conjunction with a switch (I am assuming physical switch like a limit switch) to determine a "home" position. I am interested in this concept, but have not been able to determine how to accomplish this in LabView without losing counts. As far as I can tell, I have to stop the task to change the Z-Index parameters and I don't know how to do that while the encoder is moving without missing counts.
It is the Z-Index/homing actions that I am looking for an example of. If you can help me with that, that would be great.
Thanks again.
02-28-2011 04:42 PM
There are two ways to change configuration setting on a DAQmx task. First would be in the DAQmx create channel.vi which would require you to stop and clear the task to change the z index settings. This is not what you would want as stopping the task would cause you to lose data. The second method would be to use a property node to change these values later on during the task. I ran a test where I would change the values of the Z index enable, phase, and value property nodes and reread the property node directly afterwards to see if the changes were actually made to the task. I was not able to change the Z index phase, and value property node dynamically from within a running daqmx task. It looks like the best option is to stop the task, change the values, and restart. This however may cause you to lose data as you were expecting when used within the counter task. I am looking into this more to get a 100% confirmation of this issue.
What application / purpose would you need to change the values of the z index properties dynamically?
02-28-2011 11:54 PM
I don't think there's a built-in way to do what you want, although you might get lucky and find someone has written it already. Unfortunately I don't have sample code for you, but here's my suggestion. Instead of using the Z channel to reset the counter, route it to the counter sample clock. Set up a DAQ task to do buffered position measurement, then start the motor. You'll get a position measurement every time you cross a reference mark. Create a table that matches distance between marks to absolute position. Once you've crossed two reference marks, subtract the counter values and look up that value in your table; you now have your absolute position (if you can't stop immediately after reaching a reference mark, you'll need to get the position after stopping and figure that in as well). Once you've determined your position you can stop and reconfigure the DAQ task, if necessary, without losing position.
03-01-2011 04:04 PM
03-01-2011 04:14 PM
Your choice whether to connect the Z line to the default sample clock pin, or set the Z-index pin as the sample clock source in software - I'm pretty sure you'll get the same result either way. You might want to look at the similar "Finite" version of the same example since you only need two measurements.
03-02-2011 10:02 AM
OK. I tried using the Sample Clock as discussed above and came across an issue.
The task by itself works fine, however, since I already have a DAQmx task collecting and processing the data from the counter channel, if I add the buffering task to my existing program, I get an error about conflicting resources - It doesn't seem that I can run two tasks from the same channel at the same time. Is that correct? It kind of makes sense I guess. Can I use the Sample Clock from the Z-Index trigger to pull the current position from the existing task? I know it wouldn't be as clean but would that work?