High-Speed Digitizers

Showing results for 
Search instead for 
Did you mean: 

Counter of while loop with digitizer PXI 5122

Go to solution

Hi every one, 

I am a beginner of NI products. Currently, I am using the PXI-5122, Labview 2014 for acquiring the ultrasound signals. I get a trouble when counting the number of signals using an external trigger source (from a function generator). When I trigger the digitizer under 50 Hz, the counter works correctly (one trigger = one signal). With trigger frequency over 50Hz , the counter is working wrong. For example, with 50 Hz trigger and 500 number of signals, the counter takes 10 s to acquire the data. But, with 100 Hz trigger and 500 number of signals, the acquisition time was still around 10 s.
You can see the code in the attachment file.

Please let me know if you have any suggestions or recommendations for my situation, I would like to appriciate that. 

Thanks in advance!
Best Regards,

Download All
0 Kudos
Message 1 of 5

Hello Tu,


I have looked at your code and noticed there is a 'Wait Until Next ms Multiple' in your  A_Scan_PXI_5122.vi.

This wait function is set to '20' which may be what is causing your code to run at 50 Hz even when set to run faster. Have you tried reducing this value and retrying one of the cases that was not working correctly?


I hope this helps,


Ashley Nunn | MEng (Hons) | CLAD | CTD
Application Engineer, National Instruments
0 Kudos
Message 2 of 5

Hi Ashley, 

Thanks for your answer. I reduced this value to Zero. The program is still working wrong. 


0 Kudos
Message 3 of 5
Accepted by WorldALoneMe


Looking at your code, you are software re-triggering your device.  With your configuration, you are configuring the digitizer to take a single record acquisition in your "A-Scan.vi".  This VI opens the NI-SCOPE resource, configures it, performs the acquisition, returns the data, then closes the NI-SCOPE resource.  It then does this for every single A-Scan that you perform, and would be the reason B Scan.vi is taking so long.  It appears then that under 50 Hz, this whole software resetting and reconfiguring and acquiring can occur without missing a trigger, but more than that, your triggers occur faster than it takes to do all of that.  


What you need to do it configure the digitizer for a multi-record acqusition.  This is done by using the "niSCope configure horizontal timing.vi", and wiring in a number greater than "1" into the "number of records" input.  You can find an example of how to perform a multi-record acquisition if you open the NI Example Finder >> Hardware Input and Output >> Modular Instruments >> NI-SCOPE >> Getting Started >> niScope EX Multi Record.vi"


In this example, the digitizer is only configured once, and then it returns all the requested records all at the same time.  For your application, each record would be a single A Scan, and then if you configure 500 records, your B-Scan would be 500 wide.  This then allows the hardware to re-arm itself between triggers, which is significantly faster than doing it in software.  


For a more complex example check out (in the example finder) "niScope EX Multi Record Fetch More Than Available Memory.vi" 



Nathan P.

Message 4 of 5

Thank you so much, Nathan.

Best Regards, 

0 Kudos
Message 5 of 5