How to continuously generate a pulse train with variable frequency

Dear all,
I am trying to use NI-USB 6259(BNC) to send Pulse signals to conduct position control of a servo motor with labview. The position control of servo motor follows these rules:
The number of the pulse train determines how many degrees the motor rotate ;( e.g. the angular position of motor)
The frequency of pulses determines how fast the motor rotate; (e.g. the speed of motor rotating)
The digital determines the direction of rotation of motor (e.g. clockwise or counterclockwise)
My question comes when I need to continuously generate a finite plus train signal in a period of time. Below is a sample:
Time(s)
Number of pulses
Direction of rotation
(1 is clockwise, 0 is counterclockwise)
Frequency
0-1
923
1
923hz
1-2
3540
0
3540hz
2-3
1751
1
1751hz
3-4
2663
0
2663hz
4-5
353
0
353hz
5-6
1017
1
1017hz
6-7
3436
1
3436hz
7-8
302
0
302hz
8-9
1513
1
1513hz
9-10
570
1
570hz
Here is the explanation of this table, the motor keeps rotating in clockwise direction during 0~1s. When the time reaches 1s, the motor just complete the rotation of 923 pulse signals. And then the motor starts to rotate in counterclockwise direction during 1s~2s. When the time reaches 2s, the motor just complete the rotation of 3540 pulse signals. So we can see that the rotating speed of motor in 0~1s is different from the speed in 1s~2s. Namely, the frequency of pulse signal in 0~1s is different from the frequency in 1s~2s.
I have already use the counter output of DAQmx, it just can generate pulse signal with certain numbers and certain frequency in one time. The attachment is the vi which can generate a finite digital pulse train from a counter output channel and the frequency, duty cycle, Initial delay, and Idle state are all configurable.
How can I continuously generate  a series of pulse train with varying numbers and frequencies during a certain period of time.
Thank you very much for your help!
Solved!
Go to Solution.
Attachments:
Counter - Finite Output.vi ‏57 KB
Finite output.png ‏13 KB

Hi aacuna,
Thank you for your reply!
I already checked that  article.  The frequency in that Vi can change dynamically, but the method of adjusting the frequency is ‘manual’ .Below is the front panel of that Vi. When the Vi is running we can change the frequency by press the button.   
Time(s)
Frequency
0-1
923hz
1-2
3540hz
2-3
1751hz
3-4
2663hz
4-5
353hz
5-6
1017hz
6-7
3436hz
7-8
302hz
8-9
1513hz
9-10
570hz
Thank you!

Similar Messages

  • How can we generate a pulse train with variable inster pulse delays?

    I want to generate a pulse train with random inter pulse delays (100us-10000us) and the pulse width would be 50-100us. I programmed for single pulse generation using counter cfg,a for loop contaning set attribute parameters pulse spec 1 and pulse spec 2. I changed the pulse spec 1 value in every cycle
    This program is generating the pulses but not the exact values in the sense the some times the delays are more than 10 msec. As per the program the delay should be maximum 10 msec. please help me ASAP.
    thanks
    thota

    Hey Thota,
    I would suggest to take a look at the example program linked below. It shows how to change pulse specs on the fly. You have to be make sure you are ignoring a certain error when doing this.
    Pulse Train Generation with Changing Pulse Specs (PWM)
    http://sine.ni.com/apps/we/niepd_web_display.displ​ay_epd4?p_guid=B45EACE3E21756A4E034080020E74861&p_​node=DZ52328&p_source=External
    I hope this helps.
    Regards,
    Todd D.
    NI Applications Engineer

  • Generate two pulses train with difference phase

    Hi'
    Spec:
    LW 7.1
    Daqmx
    NI PCI 6602
    freq 300kHz
    I want to generate two pulses train with two counters with a difference phase between them (change by user)
    Thanks

    Duplicated thread.
    .mrLeft{float:left} .mrInfo{border-left:solid 1px #989898;font-size:x-small;color:#989898}
    Mathieu R.  
      CTD - Certified TestStand Developer / Développeur TestStand Certifié  
      CLAD - Certified LabVIEW Associate Developer  

  • How to generate a pulse train with different pulse width and delay?

    How to generate a triggered pulse train with different pulse width. for example, after each trigger signal, let's say 2 ms, then the counter output a pulse with pulsewidth of 1 ms, and then after 3 ms delay after the first pulse, the second pulse was generated with a pulse width of 4 ms.  Next cycle when the trigger signal comes, the same two pulses will be generated and so on. Is it possible to achieve this by using 6601 counter card? and if yes, how to achieve this? Thanks!

    Unfortunately you can not create a hardware timed pulse train with different widths on each pulse from a counter. Whilst it can be changed on the fly using software, since you require a hardware triggered signal getting the software involved will not give a huge amount of accuracy when the pulse will actually change.
    So in short you can't use your 6601 card (or a counter timer) to achieve this
    There are three possible Alternative solutions
    1 You could use a high speed digital IO device such as the (6533/34) to generate your variable signal which would require setting up the pulse train as a series of states based around the burst transmission mode where the clock would give you your specific timing.
    2 A timed analogy output (for example on a MIO card with a clock (PCI-6220 / 62xx), i.e. Not the 6704 style static analogy output cards)
    3 A high speed digital waveform card such as the (, 656x , 655x, 654x, 6534, 6533 (http://www.ni.com/modularinstruments/find_right.ht​m) ) this could then be scripted to work with your triggering and also there is a digital waveform editor which will enable you to set up the pattern you wish to generate (http://sine.ni.com/nips/cds/view/p/lang/en/nid/135​55) 
    Hope that helps
    Tim Matthews
    NI (UK)

  • Finite pulse train with different frequency

    Hello,
    I'm trying to modify the labview example "generate finite pulse train" to generate a finite pluse train with different frequencies. Each freq will run 400 pulses. The freqs are stored in an array, which is being fed into a for loop. Thus ramp up the freq each iteration. However the program only generate 400 pluse at first given freq. I'm fairly new to daqmx and not sure what is wrong. Anyone have some idea how to fix it?  
    Attachments:
    pulse train finite mod.vi ‏38 KB

    The best "fix" will depend a bit on the needs of your app.
    Is it ok to have a fraction of a second without any pulses each time you change frequencies?  If so, then there's a pretty simple solution:
    1. Outside the loop you'd create a DAQmx virtual channel and configure for Finite Sampling (# samples = 400) using DAQmx Timing.vi.  
    2. Inside the loop you'd chain together a DAQmx Channel property node where you set the pulse frequency property, then perform a DAQmx Start, a DAQmx "Wait for Task Complete", and a DAQmx Stop.
    3. So for each freq in your array, you'll program the counter for that frequency, start the generation of pulsetrains, and then stop the task after 400 pulses have been generated.
    If you must change frequency on-the-fly, producing *exactly* 400 pulses at each freq setpoint will be tricky, and maybe even impossible to do reliably.  Some techniques will get you closer than others though, so post back if you need to do this.
    -Kevin P.

  • Generating two pulse trains with on a PCI 6602 (2 CWPulse)

    I am writing an application that should generate 2 pluse trains. I'am using ComponentWorks 3. I've tried to use 2 CWPulse but after configuring the 1st, i cannot start the other one because "too many controns are configured for this DAQ device".
    Do you know how to use 2 CWPulse with a 6602 device ?

    Dear Sir,
    If you need to use two CWPulse components you will not be able to set a finite number of pulses to be generated. When you set the component to produce a finite number of pulses, it actually uses two counters to perform the operation. One is used to generate the pulses and the other one is used to count the pulses that are generated. You can use multiple CWPulse components as long as the pulse type is set to continuous on both components.

  • How can I create a pulse train with varying pulse widths?

    I'm trying to create a finite pulse train that varies its duty cycle. I was hoping there was a clever way to do this neatly. I've attached a very rough picture of the train I'm hoping to make, with the pulse widths defined with t, the delay between pulses d, and a total of N+1 pulses. Thanks!
    Edit: My current method is to use the pulse train function, and actually create 2N+1 pulses, stacking the "double length" pulses.
    Attachments:
    ExPulseTrain.png ‏9 KB

    I wound up just building the first short pulse, and then the train of longer pulses, and sticking them together. I attached a screenshot of the code I went with.
    Attachments:
    VarPulseTrain.png ‏29 KB

  • Finite pulse train with variable pulse widths

    Greetings LabVIEW developers,
    Does anyone have code that can show me how to use E-series counters to generate a finite pulse train where the individual pulse widths vary? I need to generate a series of 20 pulses with the high time for each pulse randomly varying between 50 and 1000 microseconds. The low time for each pulse needs to be constant (around 50 microseconds).
    Thanks,
    Ryan Wright

    Ryan,
    Sorry, but this isn't possible with the counter/timers. I've been wanting this capability myself for about 6 years now.
    Personally, I think it's an unfortunate "hole" in product capability. The other major data acq hw allows you to capture and later replicate a signal of interest. You can capture an analog waveform with AI and later play it back with AO. You can capture a digital pattern and later play it back with timed DIO. You can capture buffered semi-periods with a counter -- but you can't play play them back later. So for your app, you'll need to generate the variable freq using timed DIO. The new M-series boards ought to work for this, or a dedicated high-speed digital board.
    There's another product that I think is even better for timed DIO though and it's put out by one of NI's "Alliance partners" -- Viewpoint systems. Here's an example of why I like it. Let's say you need to generate 20 pulses within 60 seconds. The times of the pulses need to be precise to within 1 usec, and they have no common divisors. The NI method will require you to use an update rate of 1 MHz and you'll create a buffer of 60 MB to represent the digital pattern at every usec. The Viewpoint method needs a buffer of 40 entries. Each entry is a combination of a timestamp and a pattern to generate at that timestamp. That pattern will just stay there until the next defined timestamp. So all you do is define the digital pattern at the instants when one or more bits will change. It works analogously for digital input - if you capture with 1 usec resolution for 1 minute but there are only 20 pulses (40 digital transitions), you only capture the 40 relevant timestamps & patterns instead of a full 60 MB.
    If interested, look for the PCI-DIO64 at Viewpoint's website.
    -Kevin P.

  • How can I generate synchroniz​ed pulse trains with 6602?

    Hi,
    I would like to generate multiple pulse trains with different frequencies with the 6602 TIO card. Currently I am able to generate pulse trains with different frequencies. But is there any way to synchronize all the pulse trains? For example, I'd like to have all pulse trains with their first low-to-high at the same moment.
    Thanks!
    Dan

    Dan,
    Absolutely, the NI-TIO chip on the PCI-6602 supports a start trigger. If you configure all of the counters that are generating a pulse train to use this start trigger, they will be synchronized. The example Generate Pulse Train - Start Trig (NI-TIO).vi demonstrates this process for one counter. In LabVIEW 7, this example can be found in the following location:
    Examples >> Hardware Input and Output >> Traditional DAQ >> Counters >> NI-TIO
    You will need to add code for the other counters, but this example should give you the general idea. Furthermore, this example demonstrates how you can use one of the digital lines to generate the start trigger.
    Good luck with your application.
    Spencer S.

  • How can I use the pulse train from a 6602 to trigger an niFGEN and niSCOPE on each rising edge of the pulse train?

    Hello,
    Here is my application: I need to use a 6602 counter/timer to generate a pulse train of certain frequency and duty cycle. On each rising edge of this pulse train, I need to output an arbitrary waveform on Ch. 0 of an niFGEN (5422) AND acquire data from CH. 0 of an niSCOPE (5124). I also need to synchronize the niFGEN and the niSCOPE to the same clock used for the pulse train (6602/ctr0). This process needs to continue until the user stops the system.
    I can generate the pulse train using the 6602 just fine using ctr0, but the pulse train shows up on OUT0 by default. When setting up the niFGEN and niSCOPE to trigger on rising/positive slope edge, OUT0 is not an option for either device as a source for the digital rising edge (pulse train). The main options for both are PFI0-3 and RTSI lines.
    Questions:
    1.) Is there a way that I can direct the pulse train to a location (such as an RTSI line) where BOTH the niFGEN and the niSCOPE can use it as a start trigger for each rising edge? I noticed in MAX that a route can be made between ctr0's internal output and a trigger line and others. If this is a solution, could you please explain how to accomplish this?
    2.) Once I configure the niFGEN and niSCOPE to be triggered on a digital rising edge, how can I effectively have this happen for every rising edge from the pulse train? In other words, can I just initiate the FGEN outside of the while loop and it will generate a waveform for each rising edge it sees at the source until the while loop is exitted?
    3.) Is setting a reference clock for the niFGEN and the niSCOPE the same thing as synchronizing both devices using the same clock that generated the pulse train? It is not clear to me the difference, and why it would necessarily be useful.
    Images of my current front panel and block diagram are attached. If you would rather have the actual VI's just let me know. Any help and/or explanation on this is greatly appreciated. Thanks in advance.
    Attachments:
    Front_Panel_Control.jpg ‏278 KB
    Block_Diagram_Control.jpg ‏263 KB

    Hello Cgifford,
    Welcome to National Instruments Forums.
    To output your signal to the PFI lines,
    you can use external connectios between OUT0 and PFI lines. You can also use
    the backplane to do so by routing into the same RTSI line.
    1)
    On the SCOPE and FGEN, the name of the
    terminals are actually “PXI Trigger Line x/RTSIx” but on the 6602 you might
    need to route the signal using the property:
    You can also use the DAQmx route signal which perform the same opperation.
    2)
    This will depend on the frequency of
    your pulse train. If this is lower than about 10 ms, then you can probably
    place this on a loop and start and stop the acquisition every time. If the
    frequency is higher than this, you will have to use:
    -       Scripting on the FGEN side (read more)
    -       MultiRecord Fetch (more information in the scope help file
    section “Acquisition Functions Reading versus Fetching”).
    3)
    The short answer is yes. The longer one
    might depend on how tight you need the synchronization to be (us, ns, ps). For
    very tight synchronization, you should look into here.
    Message Edited by Yardov on 06-18-2007 03:14 PM
    Gerardo O.
    RF Systems Engineering
    National Instruments
    Attachments:
    property.JPG ‏7 KB

  • Generating a pulse train

    Hello everyone,
    I'm using one counter timer from the DAQ card PCI-6014. I want to generate a pulse train with this output where I can control the number of pulses and the frequency of the pulse. The duty cycle is not important, I want to use the default value, i.e. 50%.
    I have used the vi called "train_impulsion2.vi" with the following values:
    -number of pulses = 10
    -frequency = 1 Hz
    -duty cycle = 0.5
    When I connect the output from the counter timer 0 to an oscilloscope (pin 2 and pin 53), what I see is a constant 5 V for the 10 sec. I don't see the 10 changes from 5 V to 0 V as it would be expected.  No falling or rising edges are observed.
    However by using the DAQ assistant with the vi "daq_assistant_pulse_train.vi", with the following numbers:
    -time high = 500 ms
    -time low = 500 ms
    -generation mode = N samples
    -number of samples= 10
    I'm able to observed what I want, i.e. 10 changes from 5 V to 0 V on the oscilloscope.
    How can "train_impulsion2.vi" works like "daq_assistant_pulse_train.vi"? Thanks a lot
    Marc  
    Attachments:
    train_impulsion2.vi ‏21 KB
    daq_assitant_pulse_train.vi ‏101 KB

    Hello everyone,
    Everything is now ok. I didn't put the correct leads inside the oscilloscope. That's why I wasn't measuring any rising or falling edges. Doh!!!!!!!!!!!!!
    Marc

  • Generate a pulse train

    How do I generate finite pulse train of 3 pulses of 25us pulse width, pulse period (1/(7000Hz)), and retrigger the same finite pulse train every 588.23us with the PCI-6602?
    What are the externals connections?
    What is the right Labview programming?

    this can be done with the 6602 using multiple counters, but this board has 8 so you will still have many left over for other tasks.
    You will need essentially 2 tasks, one taks is a retrigerable gated finite pulse train and the other is a simple finite pulse train.
    I have done something similar using DaqMX and LV 7.0
    To create the finite pulse train, create a CO.PulseTime task, create a channel setting the high times and low times (25 microseconds)and set the low polarity. I will assume that such a pulse train is going to trigger some external event or other DAQ card. Next set the timing to be implicit and sample mode to be finite and the number of pulses to be 3. To handle the retriggering and gate properities use a channel properitiy node and select:
    StartTrigType = Digital Edge;
    Start.Retrigerable = True;
    Start.DigEdge.Edge = Rising;
    Start.DigEdge.Src = PFI number of the out from the continious pulse train.
    This last option will allow you to route the trigger from the controlling pulse trian to trigger your finite pulde train.
    Now set up a second task to put out a continious pulse train with the period equal to the total durration between finite pulse trains (~500microseconds I dont have the exact number in front of me).
    After creating these two tasks, start the retriggerable task first.
    now when you start the continious pulse train you will get a finite pulse train of 3 pulses every time the rising edge of the continious pulse train fires. Stop and start the continious pulse train using software at will but only stop the finite task when you are done. Hope this helps.
    -Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • Generate PULSE TRAIN VI & Measure Frequency VI

    Can I RUN both Generate pulse train VI and Measure Frequency VI without either slowing down? Is Generate pulse train VI same as generate PWM VI? I have only attached the generate pulse train VI as I can only attached one file at a time.
    Attachments:
    Generate Pulse Train VI.vi ‏15 KB

    Hi labview1958,
    This depends on the kind of frequency you'd like to generate, and the range of frequency you'd like to measure. You didn't mention the kind of hardware and software (version) being used, so I'll assume you're using an E Series DAQ device and programming in LV 7.1. If you're generating a continuous pulse train, only one counter is required, hence there should be another counter available (for most DAQ devices). If you're generating a finite pulse train, two counters are required, and there'll be no counter available for frequency measurement. Also, frequency measurement can use one or two counters depending on the frequency range. You can find LV shipping examples (Help >> Find Examples) for both pulse train generation and frequency measurement. These make a good starting point for your development. In the case that you don't have a counter available for frequency measurement, you can also use the "Extract Single Tone Information" VI to measure the frequency in software.
    These tutorials will provide more details:
    Generating a Pulse Train with a Counter
    Making Accurate Frequency Measurements
    Hope this helps,
    Lesley Y.

  • Generate a pulse train using a count from a quadrature encoder as the clock

    I am trying to generate a pulse train with the same frequency as my quadrature encoder.  Every time the encoder counts, I want the pulse to go high until the next count and then go low and so on.  I am using a 6602 PCI card and a BNC 2121 accessory.

    Maybe I'm not understanding your app, but I *think* you and I are approaching it from two very different directions.
    As I understand it, you'd like to emit a pulse with each quad state change.  Then that pulse would act as a counter Source signal.  The counter will then increment on each pulse, to keep track of accumulated position.  Further, you'd use your device-under-test (DUT) as a counter Gate signal, which would buffer the position count each time there's a rising edge on your DUT.  The end result is a buffer of position values, captured at each rising edge of your DUT.
    I'm talking about a different approach to produce the same data.  You'd use 2 tasks on a M-series board.  One of them is a hardware-timed digital input task based on "change detection."  Each time one of the specified bits has a transition, your whole set of digital input bits can be captured and an internal "change detect pulse" is generated on the board.  This task should be sensitive to the DUT edges.
    The other task would be a buffered position measurement.  It would receive the reference encoder inputs and internally do quad decode and keep a running count.  The sampling clock for this task would be specified as the other task's "change detect pulse."
    Net result: on each specified edge of your DUT, you'll buffer a reference encoder position value and a digital state of your DUT.  You can choose to be sensitive to rising edges, falling edges, or (!!!!) both at once. You can also choose to be sensitive to many bits simultaneously.  These are better capabilities than you get with the 6602 alone.
    I *think* the 6220 should be ok, based on a quick overview of specs.  I assume your 3.6 MHz is the rate of ref encoder quad state changes, right?  In the approach I'm suggesting, you only need concern yourself with the rate of DUT edges which appear to be in the 10's of kHz or less.
    Gotta go for now.  Post back if any further questions.
    -Kevin P.

  • How to generate sequence of pulse trains with DAQmx?

    I need to generate a sequence of pulse trains with DAQmx (the card I have is a PXI-6229 card). As an example:
    - 10'000 pulses at 20kHz every 5 seconds with an initial offset of 2 seconds (let's say 10 pulse trains in total).
    If I use the CreateVirtualChannel.vi in "CO pulse ticks" mode, I can only specificy offset, high ticks and low ticks, but not that the sequence of pulses should be repeated after some time. 
    Now I thought that I could solve this problem if it were possible to multiply two counter outputs: the first counter would generate the pulses (continuously) whereas the second one would switch between low and high on a slower timescale in order to gate the first counter, thereby providing an initial offset and the "off" phases between the pulse trains.
    Is it somehow possible to multiply two outputs with DAQmx and the card I have? Or is there another solution to the problem?
    Thanks a lot in advance for any hints!

    Hi dlanger,
    what you want to do requires a little bit more work. 
    First look at the example "Gen Dig Pulse Train-Continuous.vi" from the LV example finder.
    This example generates a continuous* pulse train. As you see, you need a sample clock VI for setting the sample mode. 
    * NOTE: Generating a finite pulse train with a M-series card requires 2 counter.
    With a pause trigger (DAQmx trigger property node) you can gate the output of that counter.
    Now you have to generate a gate-signal with the the 2nd counter. That means, only if  Ctr1-out is high Ctr0-out outputs the 20 kHz-signal. 
    Maybe you have to adjust the times in my example a bit. 
    Unfortunately there is just one "small" problem: "let's say 10 pulse trains in total" 
    This is not possible, because a 3rd counter would be necessary (*). 
    As a workaround you can modify the while-loop that both tasks are cleared after 50s. This is not brilliant, but should work fine for you. 
    A more sophisticated way is to perform a correlated DIO. So you can generate custom pattern for multiple outputs. 
    A good example can you find here: 
    Retrigger and Repeat Finite Digital Pulse Train in LabVIEW
    http://decibel.ni.com/content/docs/DOC-8473 
    or here:  
    Generating More Than 2 Pulse Trains Using CompactDAQ
    http://decibel.ni.com/content/docs/DOC-2167 
    Hope this helps.
    With best wishes,
    Ralf N. 
    Attachments:
    Gen Gated Dig Pulse Train-Continuous.vi ‏38 KB

Maybe you are looking for

  • Error occured while deploying application in webDynpro

    Hi All, I got an error while deploying an application in web Dynpro.In order to cal BAPIs the middleware i am using is  XI i.e. im using WSDLs to call the BAPIs in R/3 system.while calling WSDLs in XI server i got an exception error Service call exce

  • Hey guys is there any way to include my form in a word doc.

    I am doing a project and i need to include a copy of the questionnaire in the Apendix but i haven't figured out quite how to do it yet. Is there something i am missing!? Thanks in advance for the feedback!

  • Add name of file as XML tag

    I want to add the name of the document as an XML tag at the top level just below root, is this possible in javascript?

  • Help Sorting array of strings with numbers in them

    Hello I need to sort an array of Strings of numbers. The order is not what I want it to be. instead of 1, 5, 20 it will go 1, 20, 5. I did a google search for this and found some code that could fix this. The only problem is I tried using it as a met

  • Jabra bt3030 w/iphone 3G s

    I'm using this. It paired easily and the sound is excellent with my etymotic earphones but I can't get the pause or fast forward and back to work. The volume control works. Am I doing something wrong? Is there another step I needed to take to get tho