Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering a 6024E into data acquisition from start and end number of finite pulse generator from a 6602

My motion control system is driven by a 6602 I wanted to acquire analog current (to a voltage via I/V converter) from a 6024 AI when:

(1) At the start of the pulse generation
(2) Stop at the end of the pulse generation
(3) Read every possible data between and stream it on the harddisk
(4) Option to skip at regular intervals to reduce amount of data accumulation

Anyone have some suggestions? What I did try and attempted was to "loop an AI from a triggered intermediate Analog Input VIs" this is rather erratic!My question for the analog input software are:

(1)Can you trigger an AI to start a continuous acquisition?
(2) How do you do AI from a "start" p
ulse train to "end" pulse train?
(3) How do you manage time for File I/O meanwhile doing (1) and (2) above?
Bernardino Jerez Buenaobra
Senior Test and Systems Development Engineer
Test and Systems Development Group
Integrated Microelectronics Inc.- Philippines
Telephone:+632772-4941-43
Fax/Data: +632772-4944
URL: http://www.imiphil.com/our_location.html
email: Bernardino.Buenaobra@ph.global-imi.com
0 Kudos
Message 1 of 3
(3,561 Views)
Hello;

The best way to go about that is to have an analog input task configured as External Scan clock, and to have some counters generating the pulse train that is going to be used as the scan clock pulse train.

Since you want a pulse train to start and stop the analog input acquisition, you can have the external pulse train to be the Scan clock pulse train, that will make the analog input task to acquire one point at every pulse of the pulse train. Furthermore, the acquisition will start and stop when the pulse train start and stop.

In case you don't want the analog input task to acquire one point at every pulse of the external pulse train, you will need to use counter in between the external pulse train and the analog input. You can configure that coun
ter as retriggerable pulse generation, have the external pulse train as the source input of the counter, and configure the width and delay of the generated pulses to be a multiple of the source pulse train. That will make the counter to generate a pulse at every X pulses of the external pulse train connected to its source pin. Then, make the output of that counter to be the Start Scan clock of the analog input task. That will make the Analog Input to start/stop together with the external pulse train, and will also make the analog input task to skeep some of the external pulses.

Hope this helps.
Filipe A.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(3,561 Views)
"(1)Can you trigger an AI to start a continuous acquisition?
(2) How do you do AI from a "start" pulse train to "end" pulse train?
(3) How do you manage time for File I/O meanwhile doing (1) and (2) above?"

Answer 1 and 2)
Yes you can, This VI is part of the search examples that ships with LV:

"Continuous Acquisition & Graph Using Digital Triggering and External Scan Clock

Demonstrates how to continuously retrieve data from one or more analog input channels using an external scan clock when a digital start trigger occurs."

Go to Search Examples in the Help/Contents of LV. Then pick I/O Interfaces/Data Acquisition (DAQ)/Analog Input/Triggering an Acquisition/Triggering a Continuous Acquistion.

This VI is appropriate ifs you want to clock the DAQ with some clock (external scan clock) other than the on board clock.
The start trigger required by the DAQ card will be a TTL signal attached to the PFI0/TRIG1 pin of you DAQ card (via whatever signal conditioning you have).
The external clock also needs to be TTL and is attached to the PFI7/STARTSCAN pin.
You tell it which AI channel to use and wire that up appropriately.

All of this stuff is in the context help for the VI.

Answer 3)
You have a misconception of how the acquisition makes its way into a file on the hard disk. You don't really "stream to disk." The VI above will run a buffered acquisition. The DAQ card sets up a buffer that fills with the data continously. When you use the VI you set up how the buffer is configured, you will see controls for buffer size, number of scans to read at a time, etc. The acquisition runs data into the buffer continously and reads from the buffer are a parallel process where chuncks of the buffer are extracted serially. You can end up with a scan backlog where the reads are falling behind the data. Making the buffer bigger helps. All of this is limited by the sampling capability of the DAQ card. 200kSamples/second is for one channel of AI. Divide by 2 for 2 channels. etc.

The short answer is that the VI and DAQ card manage the file I/O for you.

The VI above writes the scan out to the waveform chart on the front panel. You will want to wire that data out from the AI Read Sub VI to a spreadsheet file in tab delimited form or similar.

Look inside the VI block diagram. There is a While loop containing the AI Read. Every time the loop runs (unless you hit STOP), the AI Read plucks the specified # of scans from the buffer (starting from the last unread datum). If you wire the double orange wire from AI Read out of the loop (and set the tunnel for Auto Indexing) the Vi will build another buffer in memory that is a series of AI Reads appended to each other, a sequencial record of the acquisition. Here you put in a Write to Spreadsheet VI. This is in the Functions Pallete, it is the first VI in the File I/O Pallette (icon looks like a 3 1/2 disckette).

There is more to it than this. The spreadsheet Write is 1D or 2D only. By running the array out of the while loop with auto indexing enabled, you create a 3D array. (If you turn off auto indexing you will only get the last array performed by the AI Read.) You will need to create a new array withe the pages of the array placed serially into a 2d array. I don't think I want to get into that. It isn't that bad to do, but you should get some time messing with arrays on your own, then you will see how to do it yourself. One solution is to only run the While loop once with a buffer big enough to hold the whole acquisition, or in other words no loop at all. I don't know how many scans you want. The other thing is by wiring that AI Read out of the loop you are creating an array that must be dynamically resized as the loop runs. Kind of a no no. Better to know what you are acquiring size wise and letting the VI set up buffers and array space that does not need to be changed as the program runs.

Caveat: I am fairly new to this and I could be wrong about the arrays and buffers and system resources stuff. However, I have done essentially what you are trying to do succesfully, but not "continuously." I limited the AI Read to one large read that gets what I need.

"Continously" is usually reserved for screen writes as in the VI above. The computer is not required to continually allocate space for an ever expanding array to be written as a file later. Each time this VI runs the While Loop the data goes to the waveforn chart. Each new AI read overwrites the previous one. Sort of like if you turn the Auto Indexing off. When the VI stops, the waveform chart on screen would show the same data as was written to the spreadsheet.

Feel free to email me directly: mross@smpcorp.com. I will help as I can.

Mike Ross
0 Kudos
Message 3 of 3
(3,561 Views)