Triggering outgoing TTL pulse based on incoming position signal

Hello all,  
For my research study looking at reflex responses in human subjects, I have the subject's ankle attached to a motor that moves the joint back and forth through a 30 degree range. I am sending a 5-V TTL pulse from a NI BNC-2090A to a constant current stimulator (Digitimer DS7A) each time the ankle passes a specific angle. I want one pulse sent out each time the ankle passes the target angle. The VI works fairly well, but it does not fire at the exact target I set 100% of the time (sometimes off by a degree or so). We are sampling at 2000 Hz, reading 100 scans per channel with the DAQmx Read.vi. The median of the position signal is constantly being evaluated and sent to the In Range and Coerce function, the output of which is sent to a Case Structure. The min and max inputs to the In Range function are set at what I have found to be the ideal parameters (translates to roughly + or - 0.5 degrees). If I set them any narrower, the pulse is not always sent out. 
I've attached what I believe are the relevant parts of code. If anyone has any ideas of how I can make this vi run more smoothly and accurately, it would be much appreciated. Thanks in advance.  
Attachments:
Trigger outgoing pulse based on position.vi ‏58 KB

Triggering with the DAQ card:
The 6229 unfortunately doesn't support analog triggering.  Comparable cards which do are the 625x or 635x (also the more expensive 628x and 636x).  On such cards there is an Analog Window Triggering feature that would produce the exact signal I think you are looking for (see X Series user manual).  So if you have one of these handy or are looking to acquire new hardware then this would be a good solution.
Software detection for trigger signal:
If you want to continue using the 6229, see if something like the following would give what you want.  Keeping the loop simple might help make this approach usable for your application depending on how long the window is you are looking for.  It still isn't as reliable as a hardware-triggered approach.
External circuitry:
The simplest external comaprator circuit would just consist of an op-amp.  You could use the analog output to set the threshold.  The comparator output could trigger a counter output which would issue a pulse of some pre-defined width.  The issue here is that the output signal would not be high during your exact window, but rather a fixed amount of time starting at the beginning of your window (so if the speed is changing it might not be what you are looking for). 
You could in theory just build your own external circuit to generate the exact window trigger as well at which point you wouldn't need to output anything from the DAQ card (except for perhaps control voltages for this circuit).  If you're at a university perhaps you could look for a EE student that you might be able to contract the work out to?
Best Regards,
John Passiak

Similar Messages

  • Can BioBench be triggered with a 20ns standard TTL pulse?

    I am using a CCD camera system to trigger BioBench to acquire data synchronously with the camera. The camera system sends a standard 20ns 1v TTL pulse every time it takes a frame, the time it takes for BioBench to start taking data varies from experiment run to experiment run. Anyone can help me fix this and get the two systems to synchronize?

    Amiliotis,
    Since the triggering functionality in BioBench uses one of the analog input channels to acquire the trigger signal, the 1 kS/s sample rate limit present in BioBench will impose a minimum limit to the pulse width of a trigger signal, which is guaranteed to be detected. This limit is 1 ms (= 1 / 1k). The fact that your trigger signal has a pulse width of 20 ns definitely explains why your start times are not consistent from run to run. You may want to consider using a development environment, such as LabVIEW, which will allow you to overcome this issue by providing more flexible triggering options.
    Good luck with your application.
    Spencer S.

  • 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!

  • I want to create a TTL pulse. The stepper motor I'm trying to control responds to a high to low edge, when the low pulse width is greater than 0.5 microsecon​ds. What is the best way to go about creating a pulse like this?

    I'm using the NI PCI-6025E card connected to an SCB-100 wiring peripheral. I'm programming the DAQ card using LabVIEW 6.0.2 on a win95 box.
    My first attempt has yielded some surprising results.
    I created a vi with a single while loop set to true. Within that while loop is a two frame sequence. Both frames use the "Write to Digital Line.vi".
    The first frame sets the line in wire to false.
    The second frame sets the line in wire to true.
    The device channel on both frames has been set to my user defined channel nam
    e -> clock.
    clock --> sets the DIO0 channel to be digital write out.
    Using an oscilloscope and some wires I hook ground to the SCB-100's digital ground and I hook the probe to the DIO0 channel. What I see are two different pulses alternating between one another. One has a pulse width of 5ms and the other has a pulse width of about 50ms. You seem to get a grouping of one type of pulse followed by a grouping of the other type of pulse.
    Obviously this is very strange and not what I want. It is also far too slow. So I'd like to know if anyone knows how to do this properly. Remember I only need a low pulse width of 0.5 microseconds.
    Thanks,
    Any help or guidance would be much appreciated.
    Scott

    Scott,
    You don't need to use a digital line to create a TTL pulse. The PCI-6025E has two onboard general purpose counters. You can use one of these counters to create a single pulse of the desired pulse width. For an example of how to program the counters on your board, refer to LabVIEW's Search Examples>>I/O Interfaces>>Counters>>Pulse Generation>>DAQ-STC based.
    The advantage of using a counter over the digital line is that it allows you to control the timing of the pulse through hardware and not software. Thus, it is inherently faster, and the timing resolution is more accurate. The counter will count down an internal 20 MHz timebase to create the pulse delay and the pulse width.
    For more information on the hardware capabilities of your board, you can refe
    r to the User Manual online at www.ni.com/manuals.
    Hope this helps.
    Regards,
    Erin

  • Setting time critical digital output based on axis position (PCI-7358)

    HI,
    I need to set a time critical digital output based on encoder position (this will switch fast acting valves). I was planning to try the general purpose DIO but I can't find any examples, I have been through the manuals, searched the site etc. Where can I find help with this, all the examples only seem to deal with digital input triggering or RTSI? I'm thinking of an onboard program that just monitors encoder positions and sets digital outputs.
    Some time back I seem to remember reading that general purpose DIO should not be used for time critical operations, is that correct? And if so what are the other options - RTSI going to another DIO board? The DIO really needs to be deterministic, is RTSI the only option?
    Any advice appreciated / Martin
    Certified LabVIEW Architect

    Even with an onboard program you will always get a delay of several milliseconds between your axis has crossed the position and until the digital outputs are set. If this is ok for you then you could choose this approach.
    For the case that you only want to toggle one digital line the Breakpoint feature should be the best solution as it toggles the breakpoint output almost immediately when the breakpoint positions are reached.
    If you need to change a whole pattern instead of only a single line then the approach you mentioned would be the best solution (RTSI and high-speed DIO like the 653x boards). Combine this approach with the breakpoint feature by routing the breakpoint output to RTSI and using this as a update clock signal for the DIO board.
    Best regards,
    Jochen Klier
    National Instruments Germany

  • How do I get the difference in time using 2 ttl pulses

    Hi everyone,   I have a question using the delay time.  What I need to find the time interval between 2 incoming TTL pulses and fire the output TTL pulse precisely the same time interval after the second TTL pulse.  I have been using Labview 7.1 with real time module and FPGA module (I think 1.0 because I can not find wait for rising edge vi).  I am using NI 7830R card.  The length of each TTL pulse is about 1-5 microsec.  Second pulse comes in at about 1 millisec after the first one.  So I need to fire aboyut 1 millisec after the second incoming TTL pulse.  Because of the non constant TTL pulse length, I would like to reference at rising edge of incoming ttl pulses.  Can anyone give me a help on this?
    Thank you very much.
    Hideya 

    Hi Hideya,
    As is the case with many programming questions, there are several ways to go about solving this one.  The solution I have in mind is to poll the digital input line for a transition from low to high.  The simplest way to do this would be to use a loop with a shift register to store the previous digital input value.  When the current digital input value is greater than the previous value, you can get the tick count (microsecond resolution sounds like it would be sufficient).  You can then do that sequence of operations a second time.  The difference between these two tick counts can be used as the input to the wait (microsecond) function.  After that you can send your digital output pulse.
    Best regards,
    David H.
    Systems Engineer
    National Instruments

  • Counting TTL pulses within specified integration time

    Dear all,
    I have a PCI-6014 board, and I use Labview 7.1 and would like to do the following task with DAQmx7.4:
    Analog source:  analog square wave (or = 1Hz TTL pulses) produced by a function generator
    Signal: photon signals from a photomultiplier (random TTL pulses)
    I would like to count the photon signals at 100ms integration time, repetitively. But I don't want cumulative counts, just the number of photons (TTL pulses)  in every 100ms.  I would also like to make sure that I synchronize the counter with the analog source, i.e. to make sure I get exactly 10 data points in each analog cycle. ( I can't use the computer to start the function generator and it just keeps running., so I want to make sure I start counting on the starting edge of the analog wave.)
    I used to do this with the traditional DAQ and connected the analog source to the "GATE" pin of the counter , so i could count "while gate is high" ( or while gate low, or count on rising edge/ falling edge. ) However I found some problems and I think my counter wasn't counting correctly, and I would like to rewrite the task  with DAQmx anyway.  Ideally I would like to separate the signals that occur in the first 1/2 and the second 1/2 of each analog cycle. But if that is not quite achievable, I can do the separation later when I process the data, provided that I know each 10 data points from the counter correspond to each analog cycle.
    I have read several threads on the discussion board, but I still couldn't configure my applications using those examples.
    Also I wonder if the "Arm Start Trigger" function is not available on my PCI-6014 card ? Because I can not find it in the Start Trigger property node.
    Thank you very much for your reply. Any hint or advice would be greatly appreciated.
    Joyce

    ...(Continued from prev post due to 500-char limit)
    Now, here's a proposal for a method that should be able to work, though it'll require more data and more processing.  One key area to watch out for under DAQmx is the property node for "Duplicate Count Prevention."  The behavior changed between 7.1 and 7.3 (on E and/or M series, but not on TIO-based counters), then the defaults changed in 7.4, and something changed yet again in 7.5
    Bottom line: you can set it to True or False.  One setting will allow you to buffer up 0 values for intervals where there are no Source signals (photon events) within a sampling period (10 Hz hw clock).  The other setting will not record anything in the buffer for those intervals.  Clearly, you need the former setting, so you can always experiment to see how it behaves.  I kinda gave up on trying to interpret it, understand it, or keep up with the differences by DAQmx version and DAQ board.
    Ok, here goes:  I'm going to propose that you actually oversample by about 10x and that you capture the Analog square wave in sync with your photon counts.  Then your post-processing can determine for sure which samples correspond to Analog Square High and which to Low.  You'll also be able to adjust for times when you get 1 too many or one too few samples in a square wave cycle, due to having independent un-sync'ed timebases.
    So on one counter you generate a 100 Hz clock.  The other one is programmed for buffered period measurement using the 100 Hz clock as a SampleClock and the photon pulses as the Source signal (this must be set up using a DAQmx Channel property node I believe).  Remeber to be careful also about the DuplicateCountPrevention property.
    You would further setup an AI task using the same 100 Hz clock as a Sample clock.  Be sure that the 100 Hz clock task is started after starting both the other tasks.  Also, be sure to always read the same # of samples from both tasks to keep the counter period and AI data in sync.
    Voila!  You now generate a data record of # of photon pulses for each 10 msec interval along with the voltage of the analog square wave at the end of that interval.  A bit of post-processing and you're covered.  If you're not required to manipulate data while the acq tasks are running, you can surely afford to bump up the oversampling rate considerably.  The main advantage is to gain resolution on the time of transition of the analog square wave.  For any interval ending with a TTL state change, you won't know where within that interval the transition occurred.
    -Kevin P.

  • Counting ttl pulses

    Hello Everyone,
    I am attempting to continuously record (i.e. time stamp) only positive (i.e. 'Logic High' event) TTL pulses from a PMT using a PCI-6602 board via a BNC-2121.
    From reading the LabVIEW tutorials/examples it seems that I should be able to get very high precision (15 digits) from the "Get Date/Time In Seconds" VI. I need to be able to record times to the microsecond (at least). Yet when I look at the data it appears that for every digit less than a millisecond either a 9 or a 0 is recorded, which leads me to believe that I can't get better time resolution than a millisecond. Is there anything I can do to change this?
    Assuming that I can get this to work I would also like to simultaneously monitor and record a second PMT channel. Any hints or tips would be great!
    I've attached my very basic VI below.
    Cheers,
    CJ
    Message Edited by CJKS on 05-22-2006 11:53 AM
    Attachments:
    PMTcounter.vi ‏126 KB

    Yes the simpliest way to do what you want is to count the time between rising edges using a counter (the 6602 has 8 80 Mhz 32-bit counters).  Yo will not use digital io but time counting.  The gate of your counter will be the TTL/Cmos pulse from your PMT and the source of the counter will be the 6602 master clock 80Mhz, so you can count clock ticks between photons, now you have a 12.5ns time resolution.  You can use the system clock to get a time zero if you would like to use absolute time.  The olny thing to keep in mind is that you will be limited to a maximum time between pulses of 2^32/80M or 53 seconds, you will get an overflow of your counter but usually this is not a problem with photon counting.  You will be also limited to a maximum photon rate of about 20Mphoton events.sec this is also not a problem since the interesting photon events seem to happen between these time scales.  if you want a longer time scale you cvan always casceds 2 counters to get 64bit resolution but this is probablu not necessary.  Look at the buffered period measurment examples.  You can easily scale this to 8 counters with 8 PMTs if desired with your curent hardware but this gets expensive.  Goodluck.
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • How do i generate the TTL pulse from PCI 6024E DAQ card

    Hi, I'm trying to write a program which generates a single TTL pulse when it is run. My goal is to generate the pulse, send it to the output channel of my PCI 6024E DAQ card, and then use a BNC cable, to display the signal on the oscilloscope. I have written the code and I think it appears fine but when I try to view the signal on the scope I am unable to see the pulse. I have tried slowing down the sweep on the scope and have adjusted the voltage and time scales but have not seen any response. After examing my DAQ card, I noticed that none of the PFI/TRIG terminals on the card are wired; the output channel connects to terminals for DAC0OUT and Ground. I'm wondering if this pin needs to be wired in orde
    r to generate the pulse since PFI0/TRIG1 is the start trigger terminal. Any help would be appreciated. Thanks.
    Attachments:
    ttl.vi ‏26 KB

    Hi,
    You are looking for a retriggerable pulse generation. Please check the Generate Retriggerable Pulse (DAQ-STC).vi example that ships with LabVIEW.
    Regards,
    RamziH.

  • Counting TTL pulses at high speed

    Hi all,
    I am using PCI-6221 board with DAQmx to count the number of TTL pulses (which varies in its frequency between 0Hz to 10MHz) at a high speed (200,000 samples/sec.) and I am having a problem when the TTL pulse frequency drops below a certain level.
    I am using CTR0 to generate continuous pulse train at 200kHz frequency to feed to CTR1 Gate input. I verified that the pulse train is being generated fine.
    I am using CRT1 with buffered counting to collect the count for 200,000 samples at a time (duration of 1 sec.). I got the example code (Cnt-Buf-Cont-ExtClk) and pretty much used it as is.
    CTR1 Gate is coming from CTR0 Out, which is 200kHz pulse train with 50% duty cycle, and CTR1 Source is the TTL signal that I am trying to count. At first, I thought that everything was working fine with the Source signal being at around 5MHz. Then, when I had the Source signal down below about 300kHz, I noticed that the program is taking longer than 1 sec. to collect the same 200k samples. Then, when I got the Source signal down to 0Hz, the program timed out.
    I am guessing that somehow the counter is not reading for the next sample when there has been no change to the count, but I cannot figure out why and how.
    Any information on this and a way to get around would be greatly appreciated.
    Kwang

    One thing you can try is to set the counter input CI.DupCounterPrevention property, this setting will filter the input, it is possible that when the ctr 0 is slow then many of the values you are counting become zero as well and are filtered out, since they are nolonger points, the counter will not collect enough points before the time-out occurs and the counter input read times out.  I am not sure if this is your issue but I found out the hard way that this occurs when I switched to daqMX where this feature was added.  Let me know if it worked,
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • Wiring a SCB-68 to measure the frequency of a TTL pulse signal

    Sorry if this is a basic question but could someone please help me and tell me how to wire up a SCB-68 connector block (connected to a AT-MIO-16 DAQ board) so that I can measure the frequency count of a series TTL pulses (signal from photon counting). At the moment I don't understand how the PFI1-9 connections are related to the GPCTR0/GPTR1 counter connections on the block and how they're all realted to the source,gate and out 1-5 connections on the DAQ board.
    Ultimately I want to be able to put this measured frequency into a Labview program with a controllable gate period.
    Thanks in advance
    Nick

    You might want to search the Knowledge Base on the NI's Support Pages for "Cable Mapping for a 68 Pin Connector to a 50 Pin Connector". This should take you to a link that will explain the mapping of a 50way to 68way cable and subsequent lines you are looking for ( reference sub link 68F50M), I guess you have SH6850 cable connected from the AT-MIO16 card to the SCB-68.
    Please check out the information about the pin outs, that should help you work out which pins map to the counters, eg GPCTR0_source would be pin 37 on your SCB-68
    Regards
    Joe (NI)

  • Can I send a TTL Pulse in a given rhythm?

    I am new to LabView and using version 8.1.1.
    I am trying to send a series of TTL pulses in a particular rhythm, (a train of 3 pulses at 50Hz repeated every 200ms). Is it possible to do this with accuracy?
    Each pulse need to be accurate to the millisecond.
    Thank you in advance.

    Hello Lanny22,
    Lynn is correct.  If you have hardware timed (correlated) digital lines then you can do this by using the values he suggested.  If you're using a National Instruments multifunction DAQ device with LabVIEW then I would recommend looking at this example program.  Open LabVIEW and go to Help» Find Examples.  Then navigate to Hardware Input and Output» DAQmx» Digital Generation» Cont Write Dig Port-Ext Clk.vi.  This is the example program I would use to generate this pulse train.
    Cheers,
    Brooks

  • Tracking where I am in between TTL pulses

    Greetings.  I have a little Labview experience but very little with counters.  I have a PCI-6602 card with a CB-68LP connector block.  I have used up 7 of the 8 channels counting events so I have one channel left. 
    What I have is a Z pulse that is followed be four events and then another Z pulse.  I know the point in the cycle at which each of these events occurs.  I need to write in my program which event is occuring. 
    I apologize for the confusion.  It's difficult to explain.
    The ideal situation for me is that if the Z pulse is a 360 degree cycle I could track in my program if I am in the first, second, third, or fourth quarter of the cycle between Z pulses.  I know that sounds almost impossible since my Z pulse can change. 
    For what it's worth, I CAN run one of the events in a separate TTL input if that helps me. 
    I have been trying to just reference the Z pulse to a timebase, then a little math would get it done for me but I don't have a full knowledge of counter/timers. 
    Any help would be appreciated.  Sorry for the confusing post.
    Dave B
    www.signalg.com

    I am measuring the speed of an event.  To keep it simple, I am measuring the edge separation between TTL pulses.  As the event moves through a cylinder it sets off probes that will send my system a 5 volt, TTL pulse.  Knowing the time between the event passing probe 1 and probe 2 will tell me the speed of the wave.  I have 7 probes in each of 4 tubes.  Because we are running at 40 hz or less my boss would like to run all seven probes for each tube together.  This way we are writing a smaller amount of data and only using a 7 channels of a counter card rather than 28. 
    So probe 1 in each tube will generate a pulse to the same channel.
    To determine which tube I'm in I am referencing the spark for each tube.  My plan is that when the spark for tube 1 occurs it initiates case #1.  Spark 2 will make case 2 true, etc for 3 and 4.  Each case performs the exact same reading on the exact same channels.  Since not all tubes are exactly the same, each case will have custom formatting for that tube. 
    In each of these cases I am measuring the time between probes to figure speed.  We can run one tube up to all four.  My program should work for all without any intervention from the user since unused tubes will never send their corresponding case structures to true. 
    Using the 90 degrees per was when I was considering using the Z (timing) pulse to determine which tube is active.  Now that I'm using sparks for each tube that is much simpler (I hope).  The sparks coming into the DIO (adjusted to give me a clean TTL) will activate the case for their corresponding tube. 
    The 6221 is pretty affordable but I think this should work with what I have.  If it doesn't I could sell them on another piece of hardware. 
    Do you think this will work?
    Thanks
    Dave
    www.signalg.com

  • How to count TTL pulses during 100ms ?

    I need to count TTL pulses coming out of an instrument (particule
    counter). The pulses appear randomly. I must count how many pulses
    appeared in the last 100ms, and so on, every 100ms. I don't want
    cumulative counts, but the number of events every 100ms.
    I need a hardware clock, so that the counting pace cannot be disturbed
    by Windows making some weird, unrequested, CPU-hungry task.
    I fact, I need to do that for 2 identical instruments of the same kind,
    and I have 2 cards with 2 counters each, total 4 counters. My idea
    would be to use 1 counter as the clock for 2 other counters, but how to
    trigger the counter value read ?
    Thanks.

    Hi,
    In the example I gave you, you need to supply the TTL you want to count the pulse (connected on pin 37) and a TTL "clock"  which is connected to PFI0. The TTL on PFI0 permits a hardware timing (100ms for example) to count the edges that occur on the TTL source.
    If you do not need hardware timing, have a look at the example attached. You only have to connect the TTL source and the VI counts every 100ms (software timed) the edges that occur durind those 100 ms.
    Hope it will help you,
    Regards,
    David D.
    Application Engineer - NI France
    01-02-2006 01:26 PM
    Attachments:
    Compatge des fronts toutes les 100 ms.vi ‏61 KB

  • Need to generate a TTL pulse of 3 ms using USB Daq 6361

    Hi all,
    I need to generate a TTL pulse of 3 ~ 5 ms to trigger my external device. I am using USB daq 6361 with BNC connectors. I tried to use this examples(attached) but was not succesfull , can any one help me out in this, I just want a TTL pulse out to trigger my device. I tried to modify the example to see the wave form out but all it shows is a straight line. I want to generate a TTL pulse as soon as my program starts.
    Am I using wrong example? should I use somethis else to generate the pulse. please let me know.
    Thanks,
    Attachments:
    Capture.PNG ‏76 KB
    Digital - Continuous Output_ttl.vi ‏65 KB

    AnkitG wrote:
    Jeff·Þ·Bohrer wrote:
    Why would you create an Task with an analog output?  its a Digital line you want to drive! and, just create it in the project.
    Hi Jeff,
    thanks but I couldnt understand , what you meant by create in project? Can you please explain. should I create digital line but I am still getting the same error.
    Creating DAQmx items in Project Explorer saves the DAQmx object properties as part of the *.lvproj file.  This can be very useful when the Task configuration does not change in the built application and you seldom want to use the task elsewhere.  If you want to make minor tweaks to configuration of the run-time app there is even a human readable text file in the build output where properties like scale offsets, timing rates or ranges can be modified without redeploying a new app.  
    Jeff

Maybe you are looking for