LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I use both counters in PXI 6280, to read and write at the same time?

Solved!
Go to solution

Hello everyone,

 

I'm trying to use PXI 6280 counter to generate a pulse train for step motor control.  The idea is to send a finite and known number of pulses to the step motor, which belongs to a XYZ system. The point is, if, at a given time, the user or the safety system may interrupt the movement. If this happens (and will... a lot), I'll lose the actual position, because I don't know how many pulses were actually sent to the motor. That's why I want to use the other couter, to count how many pulses were effectively sent to the motor. I can start anyone of the tasks (generate or count), but only the first started task will work. I've met a handful of errors, and I'm not able to find a solution. 

Is it really possible to use both counters? I already did this in a pci system and worked flawlessly.

 

Thanks in advance,

 

Giovanno

 

Electrical Engineer

0 Kudos
Message 1 of 7
(2,865 Views)

Hello Giovanno,

 

Is difficult determine what happen without see your task cionfiguration, but probably one of your tasks use the 2 counters to be done. If it is the case you cannot use this DAQ board to read and write counter.

 

Best regards,

Abel Souza
Engenheiro Eletrônico
LabVIEW User since 8.5
0 Kudos
Message 2 of 7
(2,824 Views)

Finite counter outputs take 2 counters on M Series devices (link to M Series User Manual).

 

Could you use a clocked digital output line instead?  You would still need to generate the sample clock using one of the counters (or the frequency output line perhaps), but if you run the counter task in "continuous" mode you can still make the digital output task finite and get your exact number of pulses that you need.

 

 

It might be worth noting that X Series devices do not require the second counter for a finite counter output task (well technically they still do, but the 2nd counter is internal and hidden from the user).

 

 

Best Regards,

John Passiak
0 Kudos
Message 3 of 7
(2,819 Views)

Thanks for your reply, John_P1.

 

I'm afraid I don't quite understand your idea. Could you explain it better? 

 

Now I'm trying to generate using sample clock with Hardware Timed Single Point (the only mode this mode accepts) and configure the counter with finite samples. Is there a way to interrupt the generation of one counter when a finite number of pulses has been read in another counter? I mean by hardware, not by software. If I interrupt the generation through software, I'm pretty sure that some pulses will slip to the drivers before the software interrupts the generation.

 

Att,

 

Giovanno

0 Kudos
Message 4 of 7
(2,809 Views)

Another solution for my problem would be to generate a finite and known amount of pulses and read, in real time, how many of them was effectively generated. That would be crucial because the system can be interrupted by hardware or user - in this case, the finite pulse would not be completed, the motors would move an unknown amount of steps and I would lose the global system position.

 

Is there a way to read how many pulses were generated, without the other counter counting the pulses?

 

Sorry for the double post

 

Giovanno

0 Kudos
Message 5 of 7
(2,797 Views)
Solution
Accepted by topic author Giovanno

I'm afraid I don't quite understand your idea. Could you explain it better? 

 

M Series devices support clocking out an arbitrary digital waveform at some rate (the clock must be provided from another source though, such as a counter).  If you want to output a finite digital pulse train and have access to a counter (both counters if you find some other source for your clock, e.g. the "frequency output" subsystem), you should use this "digital output" subsystem rather than the counter output.  There should be examples in the example finder showing how to configure a finite digital output task.

 

 

Now I'm trying to generate using sample clock with Hardware Timed Single Point (the only mode this mode accepts) and configure the counter with finite samples.

 

I don't think hardware-timed single point is what you want.  Most commonly, counter output tasks use "Implicit" timing, where the output timing is determined implicitly by the user-defined pulse characteristics. 

 

 

Is there a way to interrupt the generation of one counter when a finite number of pulses has been read in another counter?

 

Yes, but it's a little tricky.  You could configure a "Pause Trigger" on the output task, with the soruce of the pause trigger being the internal output of the counter used for the input task.  Set the input counter's initial value to be 2^32-N (or perhaps 2^32-1-N, I don't have a system at the moment to verify) where N is the desired number of output pulses.  Set the counter output event behavior for the count edges counter to toggle (it's a DAQmx Export Signal property).  When the input counter reaches terminal count, its internal output will toggle, causing the output task to pause.  You can then stop the task in software (you should be able to use the counter output event from the input task to signal to the software when the output is paused).  

 

Now that I wrote that whole paragraph, I remember doing something *similar* here to work around a driver limitation.  It isn't quite the same implementation that I described above, but really you can use a counter output or a counter input to achieve the same effect (it might be a good starting point anyway if you want to try this).

 

 

Is there a way to read how many pulses were generated, without the other counter counting the pulses?

 

No.

 

 

Best Regards,

John Passiak
Message 6 of 7
(2,776 Views)

Yes, but it's a little tricky.  You could configure a "Pause Trigger" on the output task, with the soruce of the pause trigger being the internal output of the counter used for the input task.  Set the input counter's initial value to be 2^32-N (or perhaps 2^32-1-N, I don't have a system at the moment to verify) where N is the desired number of output pulses.  Set the counter output event behavior for the count edges counter to toggle (it's a DAQmx Export Signal property).  When the input counter reaches terminal count, its internal output will toggle, causing the output task to pause.  You can then stop the task in software (you should be able to use the counter output event from the input task to signal to the software when the output is paused).  

 

Thanks, John Passiak!

 

It worked like a charm... just like you said, a little tricky to pull off, but it works just as it should.

 

Just to mention: yesterday I was trying a different approach: use infinite generation and stop it by software. It would then be trivial to count the pulses with a simple counter. I would, then, eliminate the error by generating pulses by software to a digital output.

 

Thanks once again,

 

Giovanno

0 Kudos
Message 7 of 7
(2,764 Views)