Send counter/digital outputs while acquiring analog data

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.

Hi LVhelpME, 
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,
Message Edited by dansch on 11-22-2008 04:24 PM
Daniel S.
National Instruments
Attachments:
CreateTriggerLine.vi ‏19 KB
FrontPanel.png ‏57 KB
FrontPanel2.png ‏36 KB

Similar Messages

  • Digital outputs while sampling analog inputs

    I am currently developing a program using LabView 2012 SP1.  I am interfacing with a NI USB-6009 DAQ using NI-DAQmx 9.5.5f4.  I am attempting to acquire a voltage reading on three analog inputs (AI0, AI3, and AI4) at 1 second from startup and at 20 seconds from startup.  The three digital ports: P0.0, P0.1 and P0.2 are used to turn on transistors for the signals in question and must remain high during the ~20 seconds the readings will take place.  I have figured out how to acquire 20 samples over 20 seconds on the analog inputs but have trouble with the digital outputs.  The DAQ assistant is not a good option and the USB 6009 has limitations that are not necessarily covered in the example code im finding.  Basically I need to turn on (write hex 7) to port P0.0-2, acquire my analog samples for 20 seconds, then bring port P0.0-2 low and end the program.  Can anyone help walk me through this?  Thank you in advance.
    RJ
    I surf therefore I am....

    Solved it.  See attached vi.  
    I surf therefore I am....
    Attachments:
    Level.vi ‏69 KB

  • SB X-FI Titanium.. Digital output works but Analog Signal M.I.A.

    @SB X-FI Titanium.. Digital output works but Analog Signal M. I.A. Hi Guys,
    I recently installed a new hard dri've on my machine after my power supply failed and fried it. After reinstaling Vista 64 and my drivers I noticed that my sound card was not working properly.
    In.. control pannel > Sound > Playback I see my soundblaster listed but only the digital out is showing. There are two other icons listed.. one is for "Digital Output Device 2-High Definition Audio Device.. and one for a 3-High Definition Audio Device. I don't remember these being listed when my sound card was working properly before the HD crash.
    No icon representing my analog output (Left/Right, Center, and Rear?Speakers)?is displayed. I reinstalled the drivers, updated the drivers, reformatted my HD and started all over again but nothing works.
    I made sure that my motherboard sound card is disabled.. I am really stumped.. The sound card used to work quite well.. Has anyone else had this problem and been able to fix it's
    Here is my system info:
    Motherboard: Gigabyte GA-MA790FXT-UD5P (Realtek Audio Disabled)
    Sound Card: Internal Sound Blaster X-FI Titanium
    Any advice is much appreciated.

    DRe: SB X-FI Titanium.. Digital output works but Analog Signal M. I.A. High definition audio device is what your card is detected as until you install the original CD driver or the Daniel K 2.0 support pack. Then you can update to the newest Creative drivers. I tried to format just like you and thought that I would just download Creative's newest driver and start from there. No Go!!? The newest Creative driver seems to install, but then after reboot like you, I have multimedia audio device.
    So take out your CD if you have it, and run the driver setup only. Then using just this driver you can install all of the newer Creative updates. The Creative auto updater is installed along with your original driver and you will see it detect all available updates.
    Easiest solution of all,
    Try this pack and save yourself a load of hassle........
    http://forums.creative.com/t5/Sound-Blaster/SB-X-Fi-Series-Support-Pack-2-0-05-5-2009/td-p/527485
    This will install a very proper Creative driver, and applications that will work very very well on your system compared to the CD orignals

  • What is the best way to Sync Digital Output(TTL) with Analog Output?

    I am trying to generate Analog waveform that synchronize the rising edge of a digital signal(TTL). The ttl will be used as trigger for camera. The board I have is USB-6343X. In my draft,  I used a clock as ttl so I can tune frequency easily. Could any one tell me what's the best way to accomplish such task? My draft seems working, but I hope there's more neat way. Thanks in advance for any help!
    Kind regards,
    Eric

    Hi Econg,
    You should be able to trigger your TTL output with the analog output by using the ao/StartTrigger as your trigger source on the counter task. You wouldn't have to have the extra Get Full Terminal Name.vi in your analog output task.
    Here is an example using your modified code. You will have to change the cDAQ1/ao/StartTigger to *your device*/ao/StartTrigger, but it should then trigger the counter output at the exact time when the analog output starts.

  • Is Digital Output worse than analog output in 5.1 set

    Hi, I've read in this forum (I don't remember where) that Digital Output doesn't sends 00% of sound, instead it reduces its quality by something (encode / decode) so I would like to know your opinions and if this is true or false?
    I have plans for using 5. sound.

    The sound card, as I said before, will send out DolbyDigital or DTS recorded on a DVD-Video. This is because the encoding process happend in the studio, at the making of the disc.
    Any other surround sound, created in your computer (like the games) will not be encoded surround on the digital out. That goes for X-Fi also.
    And Yes, the DD and DTS are compressed formats, but are waaay batter that any other compressed format. DTS in my opinion is the best, but occupies more space on disc (higher bitrate).
    The only uncompressed surround is the one on the SACD discs or the one on DVD-Audio (actually this is compressed but without loosing information, kinda like the zip files).
    There are sound chipsets capable of Dolby Digital encoding: one is the nVidia's nForce2 motherboards with SoundStorm (not in production anymore). This is the same chip used in XBOX (that has DD out).
    The others are some chips made by C-Media: CMI8768+ (only the PLUS variant) and CMI8788 (this has DTS encodin also). But the encoding is done software, and occupies some 0% of the processor time. Not really good...
    Message Edited by SoNic2367 on 04-2-2006 08:2 PM

  • How to use an external clock to acquire analog data?

    I need to acquire dta using an external clock which has a variable frequency (in a small range). I am using a PCMCIA 6062 board. Does it accept external clok?

    The 6062 can acquire data based on an external clock. If you are programming in LabVIEW, take a look at the shipping example called Cont Acq&Graph ExtScanClk.vi. If you are using C or VB, there are examples in the NI-DAQ/Examples folder.
    Regards,
    Brent Runnels
    Applications Engineer
    National Instruments

  • How can I display a avi-file while acquiring data from a DAQ-CARD at the same time

    While my system is acquiring analog data and controlling a motor, I want to display a avi-film (preferably in full-screen, so that the LabView GUI disapears during this process). Are there any VI's to open external players? May I face some problems to lose samples, due to the calling of external players?

    mhi wrote in message news:<[email protected]>...
    > I've already found this example, but it doesn't work with the latest
    > media-player. Anyhow, thank you for your answer!
    you can also try out this free vi from my website:
    http://www.geocities.com/irene_he/FunStuff.html
    Irene

  • Duplicate digital output on 32-bit port

    Hi all, any help appreciated with the last (!) step in a very time consuming puzzle...
    I have a PCI-6254 card with 2 x 64 channel breakout cables. Each cable goes to a remote box, each of which essentially runs a multiplexer and acquires analog signals.
    Each multiplexer needs an array of  4-bit addresses (eg. 0 to 15) to cycle the multiplexer channels, which I can succesfully generate on port0\line0:3 which are found in cable 1 going to box 1.
    My mission is now to duplicate this digital signal in the second cable going to the second box. For this card, Cable 1 has port0\line0:7 and cable 2 has port0\line8:31. I understand that it's a 32-bit port, so I need to send it a 32-bit address.
    So I simply (!) want to send identical digital outputs on port0\line0:3 and on (say) port0\line8:11. They should be triggered by the same clock, etc.
    Is this possible? However I try so far I can only generate an output on lines 0:3. From what I've read, I'm wondering if the whole of the port is tied up by writing a 32-bit number to the first 4 lines....
    Thanks!
     

    Thanks both, really appreciate your input. I think I tried something like that today with no success but maybe I did it wrong. It ran without errors but just generated the output on 0:3. I'll try your suggestion in the morning (New Zealand evening now).
    I think I need to replace the 1D boolean with a 1D U32 array to send the right bit address (I am sending the mux channels in a funny order, something like 4,0,3,6,10,etc). But then I fear that it will only run one task, as the whole 32-bit port is being addressed each time.
    GerdW - could you explain how I would go about setting the right bits to send, say, a value to 4 to both sets of lines? I can't get my head around it...
    Thanks guys!

  • MyDAQ, Increase Digital Output?

    Hi y'all,
    I'm currently working with a myDAQ trying to trigger three 3V relays through the digital outputs. My main problem is instead of giving me 5V when triggered, the digital outputs are only giving me ~2V since they can turn on an LED, but they don't switch my relays. Is there any way to increase the voltage coming from the digital outputs?
    I've tried using the analog outputs instead (since they can put out 10V), but can't seem to get those to work the same as the digital outputs. I essentially just want to press a button and the output to send a steady voltage >3V and then turn off once I press the button again. I got this to work with the digital outputs, but the analog outputs throw me buffer errors and other input errors I can't seem to fix.
    I'm a beginner to LabVIEW and myDAQ and would appreciate any help! Thanks!

    Hello SNorrell,
    According to the myDAQ's specifications, each DI/O line can source a maximum of 4mA, which won't be enough to drive your coils unless you use multiple outputs to drive each.  I don't recommend attempting that. 
    Depending on how many relays you need to use, however, it's likely that you can get a few to work without additional hardware by using the built-in 5V supply line to drive the lines and grounding them at the DO.  Invert the logic on your digital lines so that they go low to turn on the relays. You'll need to account for power-up conditions and ensure your hardware doesn't toggle on or off unexpectedly when powering on the DAQ or the PC. You'll also want to ensure you're not driving too much current to the digital pins, refer to the documentation for current and voltage limits.
    Regards,
    Tom L.

  • Need help with waveform and digital output

    Hey everyone,
    I am driving a rotational motor with an example waveform output VI and an example digital output VI. I am able to successfully send a square wave with the desired properties to rotate the motor and I am also able to successfully send a digital output (1 or 0) to change its direction (clockwise/couter-clockwise.
    However I need some advices to write a setup such that after the motor runs as desired, I can return the motor back to its original position. I think the simplest way is timing how long it takes to finish its task, and just change the digital output, keep the same wave properties and run for the same amount of time.
    So how can I time how long the program runs and with some kind of button, change the digital output and run the program again?

    As more of a program architecture tip, this sounds like a great time to be using a State Machine.  I say this because you mention resetting the motor (one state) then running it again (another state) repeatedly.  As a design tip, I would check out this article, along with the Design Pattern Template that comes with LabVIEW.  You can find this by going to File >> New... then expanding the tree to VI >> From Template >> Frameworks >> Design Patterns >> Standard State Machine.
    Cheers, 
    Brian A.
    National Instruments
    Applications Engineer

  • How to input/output a digital signal and acquire an analog signal at the same time?

    Dasylab, version: 8.0.04
    Acquirement Card: PCI1002L
    When I use DasyLab to acquire the analog signals is no problem without digital inputs and outputs,
    and when I use DasyLab to input or output a digital signal is no problem also, but when I do that at the
     same time, DasyLab tell me the rate is too high and stop.
    so, I searched the manual book1 (user guide) for that, it showed me :
    To internally equalize measurement time and system time in the analog input, digital input and counter
    hardware modules, use the following settings:
       Synchronization: PC Clock
       Sampling rate: <= 5Hz
       Block size: =1
    the problem is, if I set the Sampling rate to 5Hz, the speed of the acquirement datas is not enough for my
    application.
    so, how to improve it? who can give me a example programm for me. thanks!
    by the way, I come from China, my English isn't good, I'm sorry.
    Allen, China.

    Hi,
    Have things changed over the years?
    I need to syncronise a digital output (Modul NI9474) and an analoge input (AI-Modul NI9203) module. I need to measure time intervals from a flank in signal A to a flank in signal B. I would like accuracies of the order of 1 ms. Currently, the signals are not synchronised, with errors of the order of 2 times the block length (block size x sample rate), sometimes much higher. The best I got so far was a block size of around 20 with a sample rate of 1 kHz.
    If I use the master and slave settings on the RTSL settings, my program doesn't run properly.
    If I use digital signals for input and output, I can syncronise them with RTSL settings and everything is good, but I can't always do that.
    Also, if I do anything in the GUI (such as scrollowing something or going to another window), my output gets screwed up properly.
    1. What can be done to synchronise AI with DO?
    2. Is there something that can be done to avoid messing up the output when something happens in the user interface? (I know that I am messing up the outputs as they make some valves switch and that is loud).
    Thanks in advance!

  • How to send TTL output AND acquire AI voltage data using USB-6211

    Hello,
    I am relatively new to Labview, so please bear with me.  I have a research application involving 2 pressure transducers and a high-speed camera.  I wish to acquire analog voltage data from the 2 pressure transducers.  However, at the start of the acquisition, I will need to send a single TTL output to trigger the camera.  This TTL pulse must be sent out at exactly the same time that the AI acquisition begins, in order to ensure that my 2 pressure measurements and camera images are 'synchronized' in time.
    Is this possible on the USB-6211 running with LabView 8.20?  I currently have a fairly simple LabVIEW vi that uses a software trigger to start an AI acquisition - I have attached it with hopes that it may help anyone willing to assist me.  I would prefer to be able to simply add something to it so that it will output a TTL pulse at the start of the acquisition.  
    Thank you in advance.
    Regards, Larry
    Message Edited by Larry_6211 on 12-19-2008 11:24 AM
    Attachments:
    USB6211_v1.vi ‏212 KB

    Hi All,
    I'd like to clear a few things up. First, you'll find that if you try to set the delay from ai start trigger and delay from ai sample clock to 0, you'll get an error. Due to hardware synchronization and delays, the min you can set is two. Note that when I say two, I am referring to two tick of the AI Sample clock timebase, which for most acquisitions is the 20MHz timebase. I modified a shipping example so you can play around with those delays if you want to - I find that exporting the signals and looking at them with a scope helps me visualize what is going on. The Manual has some good timing diagrams as well but it looks like you've already hit that. The defaults would give you a delay of  250ns from the start trigger - is this too high for your situation? What is an acceptable delay? I tend to think that "exactly the same time" is a measure of how precise rather than an absolute (think delays in cable length making a difference.)
    With all that in mind, I see a few options:
    Start your camera off of the AI start trigger (an internal signal) and just know it is 250 ns before your first convert. 
    Export the convert clock to use as a trigger. This assumes your camera can ignore the next set of convert clocks.
    More complicated option: Internally you have an ai start trigger, sample clock and convert clock. From your start trigger to the first convert is 250ns but if you export your convert clock you're going to get future convert clocks as well. One option would be to generate a single triggered pulse using a counter (start with the  Gen Dig Pulse-Dig Start.vi example) with the AI start trigger as the trigger for the counter, an initial delay of 250 ns, and a high time of whatever you want it to be. This should give you a singe pulse at very close to same time (on the order of path delays) as your first convert clock. 
    Hope this helps, 
    Andrew S
    MIO DAQ Product Support Engineer
    Getting Started with NI-DAQmx
    Measurement Fundamentals
    Attachments:
    Acq&Graph Voltage-Int Clk.vi ‏37 KB

  • How to acquire serial data on a digital input line with good performance?

    Hello,
    we have a performance problem with our realtime controller. Our objective is, to read a 24-bit long digital waveform from a digital input line. To do this, we supply a clock signal (236 KHz)  to the PFI1 Line of our DAQ Board. On each rising edge of the clock, a new bit is set on the digital input DI0.
    Our hardware which transmits the data, is triggered through a digital output from our realtime controller. On each edge on this output, the hardware starts a serial transmission of 24-Bits.
    Everything works fine except the bad performance of our realtime controller. We want to acquire the 24-Bits in a 1ms timed loop. To measure performance we wrote a test program. In that, we only triggered the hardware and transfered the data to the realtime controller. The task which is doing this job, has a approx. CPU-Load of 30%, which is, in my humble opinion, very high. The task is not waiting for data or anything else! We have earlier implemented a control which is also using a 1ms timed loop. This control is sampling 2 analog input signals, 2 counters. Futhermore it's sending telegrams with CAN and doing many calculations. The strange thing is, this much huger program has a CPU-Load of 25%. Does anybody know where the problem is?
    For the better understandig I attached our test-program to this text.
    We're using:
    PXI-8175 realtime controler
    PXI-6221 Multifunction DAQ
    Thanks!
    Regards, 
       Crest!
    Attachments:
    dig_test.zip ‏51 KB

    Hello,
    First of all 30% CPU-Load is normal because the DAQmx-driver needs a lot of resources.
    In your programm you should place a wait (for example with 1ms) into the while-loop which causes
    lower CPU-Load.
    If this is not enough you should build your vi like in the following example.
    Regards,
    Christian
    Attachments:
    Read Dig Port.vi ‏51 KB

  • How to combine Digital Output, a delay and Analog Input in a fast loop

    I need to develop a process loop that runs at least at 250 Hz that performs a Digital output, than a delay of 50 microseconds and than an analog input of all the channels. All will be done using ATI MIO 64E3 card. Of course, the acquired data will be processed, displayed and saved. The loop will be running for several minutes until user stops it.

    The fastest and most precise timing will occur if you use hardware timing. You can apply hardware timing to analog input on the E Series boards, but not the digital lines. Let's focus on the analog input first. Continuous waveform scanning uses a scan clock, which can be the board's internal one or an external one which you apply. If you want to scan all the channels 50 microseconds after a digital rising edge, then you need an external signal to signify that scan clock.
    The E Series boards also have 2 counter/timers onboard that you can use for this purpose. You can set up a retriggerable pulse generation operation, where the counter receives a trigger and then on the user specifications, produces a pulse. You can have that route to the analog input scan clock.
    The trigger signal for the counter is that digital pulse. As I mentioned earlier, there is no hardware timing for the digital lines on an E Series board. We do have other digital boards (653x family) that have hardware timed operations if precision is important. If you are satisfied with software's resolution (in the milliseconds), then you can call the E Series board digital function in a loop with a software timer. That digital line can route to the counter to act as the trigger.
    So, on the programming side, you can have three separate and independent operations in parallel. One is for the digital function to output on that line every so often. Another is for the counter set at the retriggerable pulse generation. The last is for the analog input. I will describe this in terms of LabVIEW, but it can be done in a similar fashion with the NI-DAQ function calls or Measurement Studio.
    The digital examples are in the LabVIEW >> Examples >> Daq >> Digital >> E-Series directory. The Generate Retriggerable Pulse example is in the LabVIEW >> Examples >> Daq >> Counters >> DAQ-STC directory. The E Series boards use the DAQ-STC timing chip.
    Go to the LabVIEW >> Examples >> Daq >> anlogin >> strmdisk.llb directory and start with the Cont Acq to Spreadsheet File. This shows how to continuously acquire data and stream it to disk while displaying the data on a chart. Streaming to disk is the efficient way to save data while you are acquiring, as it eliminates the overhead of always opening and closing the file through the iterations of the loop. This saves to a file that can be opened by other applications (Excel, Word, etc.), but it is not as fast as writing to a binary file, which must be opened and read back through LabVIEW. However, for your ~250 Hz rate, it should be fine. Then, go to the LabVIEW >> Examples >> Daq >> anlogin >> anlogin.llb and look at the Acquire N Scans -ExtScanClk example. This shows how to apply the scan clock. Here, the AI Start that you saw in the previous example is replaced by 4 VIs (3 AI Clock Config's and the AI Control). Make those changes to the first example and then add a constant 0 to the AI Control parameter for total scans to acquire. That specifies the continuous operation. The File >> VI Properties >> Documentation menu item of the example describes the physical connections.
    If you aren't using LabVIEW, use the NI-DAQ User Manual and the NI-DAQ Help file installed on your machine. You can look at your AT E Series User Manual at the http://www.ni.com/manuals pages for more information on the hardware. Also, if you want to route those signals internally on the board, you can find some entries in the KnowledgeBase at the http://www.ni.com/support pages.
    Regards,
    Geneva L.
    Applications Engineering
    National Instruments
    http://www.ni.com/ask

  • How to acquire analog signal and send a TTL pulse at the same time based on PXI 6123

    Hi,
    I am using a PXI-6123 data acquisition card, as the picture show in the attachment ,I want to acquire the analog signal of ai0 through reference analog window and at the same time send a TTL signal to trigger my camera. I have tried two methods, one is using the DAQmx Export signal.vi another is using DAQmx connect terminals, but when the data acquisition card acquire the analog signal, the DAQmx Export signal.vi and the DAQmx connect terminals sometime can send an TTL pulse ,sometime can not.
    I don’t know why?  or some other method that can achieve my arm is appreciated.
    Regards
    chunlei
    Attachments:
    method export signal.vi ‏21 KB
    method connect terminal.vi ‏36 KB
    Send a TTL pulse.JPG ‏288 KB

    Hi,
    Have things changed over the years?
    I need to syncronise a digital output (Modul NI9474) and an analoge input (AI-Modul NI9203) module. I need to measure time intervals from a flank in signal A to a flank in signal B. I would like accuracies of the order of 1 ms. Currently, the signals are not synchronised, with errors of the order of 2 times the block length (block size x sample rate), sometimes much higher. The best I got so far was a block size of around 20 with a sample rate of 1 kHz.
    If I use the master and slave settings on the RTSL settings, my program doesn't run properly.
    If I use digital signals for input and output, I can syncronise them with RTSL settings and everything is good, but I can't always do that.
    Also, if I do anything in the GUI (such as scrollowing something or going to another window), my output gets screwed up properly.
    1. What can be done to synchronise AI with DO?
    2. Is there something that can be done to avoid messing up the output when something happens in the user interface? (I know that I am messing up the outputs as they make some valves switch and that is loud).
    Thanks in advance!

Maybe you are looking for