10-17-2008 11:33 AM
Hello all
I am looking to acquire analog inputs on several channels, and send single TTL pulses out at different times during acquisition using a UBB-6221 board. The delays from the beginning of acquisition and the output of the TTL's should be handles by a control on the front panel. I have gotten this to work using software timing and an inexpensive board before, but the program needs to be more accurate than this (hence hardware timing). I am writing the program using LabView 8.2 and DAQmx, but if needed, I have 8.5 available as well. I am plenty familiar with the general LabView program, but am not comftorable with DAQmx, which I assume I need to use (I have only really used the Assistant). If there is an example of this somewhere, or if someone has done this in the past, I would really appreciate the help!
thanks!
Solved! Go to Solution.
10-17-2008 11:44 AM
Hey,
You will find a lot of examples on low-level programming under [LabVIEW Folder]\examples\DAQmx\....
I would suggest you to have a look at the analog in examples to simply understand how to work with the low level vis, then to have a look at the synchronization folder so that you can see how to synchronize different tasks with each other.
You will need to synchronize your DIO with the AI task timing. However out of your description you will need to implement a kind of logic to exactly write the digital patterns at the desired times.
Hope this helps,
Christian
10-18-2008 03:28 PM
I came up with this, simply by modifying the analog input/digital input example, and putting a counter output in, I am not sure how to make the timing work, but does this make any sense at all?
Thanks!
10-20-2008 06:49 PM
Hello,
I am wondering if you could be slightly more specific on what kind of pulses you wish to output based on the AI signal and the situations in which you want to output them. Are you going to be outputting a pulse train after the AI task starts, or will you be generating a single pulse? It sounds like you may be trying to generate a single pulse based on some trigger, and that you would like the option of setting a delay and to also change the duty cycle (high ticks and low ticks). Is this pulse supposed to be synchronized with the AI sample clock in any way (this appears to be true since you are trying to share the ai/sampleclock signal in your program)? If so, the best option would be to perform a retriggerable pulse generation, in which the trigger is the AI sample clock. An example of this type of program can be found in the Example Finder under Hardware I/O » DAQmx » Generating Digital Pulses » "Gen Dig Pulse-Retriggerable.vi". Please let me know if this is the type of behavior you are trying to produce or not. Thanks!
10-21-2008 12:01 AM
Thanks for the reply
What I am trying to do is send a single TTL high (5V) pulse from the board to other instruments in the lab. There will be multiple outputs when the program is finished, (more channels of outputs of single pulses to different instruments). The pulses needs to be synced with the analog input because the data acquired from the other instruments is related to the data that is being acquired which changes in the course of time. When I get this figured out, the delay should be started at the same time as the analog input, and send at its respective time.
As an example
analog data 20,000 samples at 100 Hz
Delay 1 = 0 seconds
Delay 2 = 10 seconds
Delay 3 = 15 seconds
Time: t=0 sec___________________________________t=10 sec______________________t=15 sec________________t=20 sec
Analog: Analog input starts__________________________________________________________________________ analog input finishes
Digital: TTL to instrument 1____________________Single TTL to instrument 2______Single TTL to instrument 3
10-22-2008
10:10 AM
- last edited on
06-05-2024
03:58 PM
by
Content Cleaner
Hi LVhelpME,
Thanks for the details. Based on the type of application you are creating, my suggestion would be to use a digital output task and correlate this with your analog input. In this way, you can create a digital waveform which consists of 20,000 samples and you can place the pulses within this waveform at the exact position you would like. Once you share the ai/sampleclock as being the source of your digital output sample clock, you can have the tasks synchronized together such that the pulses will occur at the exact moments the analog input acquire a sample.
You may find a good example of performing this type of correlated digital output using an external clock in the LabVIEW Example Finder under Hardware I/O » DAQmx » Digital Generation » "Write Dig Chan-Ext Clk.vi". In your case, you would want to also have your analog input task running and sharing the ai/sampleclock as the source instead of an external source. Additionally, as in your first example, you will want to make sure that the digital output task is started before the analog input task since it will wait for the ai/sampleclock to start.
Additionally, I wanted to point out that you can create a digital waveform programmatically or manually, but the easiest method I have found for creating digital waveforms is to use the NI Digital Waveform Editor. This is a very good tool to use and makes creating these waveforms very simple, especially when dealing with increasingly complex waveforms and multiple channels.
Regards,
10-25-2008 04:35 PM
Daniel
I finally got a chance to look over my program again this morning, I think I got the tasks rolled into one sample clock, If what I did is correct how would I go about incorporating a delay in it while still sampling analog data?
Thanks again for all your help!
10-27-2008 07:09 PM
11-21-2008 11:50 AM
Hello all
I am back at it again, I have gotten the program written as Dansch said, and it seems to be working fine, however, the program seems to be held up by my digital waveform generation. I do not have the waveform editor, and don't have the funds to purchase it, so I used a for loop to create an array. Is there some other way to create an array of waveform that I am missing that would not take up all of this space? The array would need to be low until a time specified from the front panel, where a single high pulse would be sent and then low again.
11-22-2008 04:22 PM - edited 11-22-2008 04:24 PM
There are a number of different ways to do this, but I created a quick method which makes a digital waveform with the requested number of samples and rate, and then allows you to specify at what time you want to insert a "trigger" (which basically means it will place a high in at that point in the waveform). I did this by using only 3 functions and a for loop which iterates depending on how many triggers you wish to insert. You can use a similar method or just make this code into a subVI that will create your correlated digital data according to total number of samples, sample rate, and what specified times you want the triggers to occur at. I have attached the VI below for LabVIEW 8.0 and later, as well as a screenshot showing what the digital waveform will look like based on what values are entered for trigger times. In the screenshot below, you will see that there are 2000 total samples which are output at a rate of 100 Hz. Thus, the total waveform will last for 20 seconds, and the trigger times are entered as 5, 10, and 15 seconds.
The next image shows a zoomed in view of the trigger that is created at the 5 second mark, which will last for the sample period of 0.01 seconds (period of 100 Hz sample clock).
Hope this helps,