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.

Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting the number of samples when all counters are being used

Hi All,

 

I'm using PXI-6284 which has 2 counters on it, and I'm outputting 2 pulse trains using these 2 counters. Using an "elapsed time" function to control the number of pulses is not very accurate and I cannot use the finite samples option as there are no free counters.

 

How can I use the elapsed time function to control the output roughly, and then after the fact get the actual number of pulses that were made? CO.Count is not very useful here.

 

I need to be able to compare the number of pulses made with the PXI module against the number counted by the microcontroller on my DUT.

 

Please help.

 

Best,

Adrian

0 Kudos
Message 1 of 6
(5,103 Views)

Hello;

 

Is it possible for you to attach an image of the code you have  developed ? What do you mean by control the output roughly ?

 

Regards,

 

0 Kudos
Message 2 of 6
(5,062 Views)

Hi PQM,

 

What I mean by roughly, is by using software control, which is variable.

 

I say this based on empirical evidence. After running the setup many times, the number of pulses counted by the microcontroller varies without any changes to the VI. When I reduce my output to only 1 pulse train and use the finite number of pulses, the microcontroller count matches the number of outputs.

 

In addition, the elapsed time output is variable (see comment in VI).

 

So to recap, what I need to know is - Is it possible to run the code as attached (or improved by any ideas?) and read a property or value that records the exact number of pulses that were generated by the task (even if it is for only 1 of the counters)?

 

Please see the code attached.

 

Best Regards,

Adrian

0 Kudos
Message 3 of 6
(5,040 Views)

Hello Adrian;

 

I think the following link is useful in this case: 

 

http://forums.ni.com/t5/LabVIEW/Pulse-train-finite-with-two-counters-or-continuous-with-read/td-p/11...

 

Please take a look of it !

 

Regards,

 

Pablo

 

0 Kudos
Message 4 of 6
(4,993 Views)

Hi Pablo,

 

Thanks once again for you efforts!

 

That post was looking very good, as the OP had the same problem as I do. I also have the same problem with the proposed solutions though, with it not being a buffered output.

 

The other solution of the 2 DIO's is crafty and I've seen that idea implemented before.

 

What I've done to get around the software timing issue (*for the interim) is to build in some tolerance in TestStand. I've set it up so that the VI runs and re-runs until the "correct" elapsed time is reported, which results in a known number of pulses (also with some tolerance). This is by no means the solution I want, so I'm still looking.

 

I am afraid though, that this is a hardware problem and cannot be solved in software.

 

Thanks again!

 

Best,

Adrian

0 Kudos
Message 5 of 6
(4,982 Views)

Will the following work (or is it too late)?

Start finite digital 1 line write with 1 s buffer (all zeros), regenerate. Clock - counter 1 output. Software elapsed time will give you approximate time, propery Write -> current write position - gives exact count when counter stopped.

 

0 Kudos
Message 6 of 6
(4,743 Views)