Frequency shift pulse modulation (DAQmx)

Good morning,
I have written this simple program which reads ones and zeroes from a txt file, and modulates pulses. When 0, creates one pulse with certain freq, when 1, creates two pulses with 2*frequency (so 1 bit each 1000/freq ms)
For lower frequencies that 250/500Hz it works perfect. For higher frequencies, it do strange things and I just can't see why. For instance, when I tried this binary serie (1 0 0 1 0 0 1 0 0..) it should be 2 slow pulses, 2 fast pulses; and it shows 3 fast pulses, 1 slow pulse. If I try higher frequencies it do weird things. 
What confuses me most is how it perfectly works for lower freq than 500 and not on higher. Any ideas?
Thank you in advance,
Bernard
Attachments:
Lee txt y modula v0.2.vi ‏26 KB
binary serie.txt ‏311 KB

Using a time loop instead of while it works untill 500/1000Hz. An improvement, but still far from what I need. And still have no idea why it won't work on faster freq. I attach this VI.
I have thought about creating two continuous pulses with frequencies f1=2*f0 and start both tasks. Then, multiply the fast signal for the binary serie, in a timed loop with certain period (T=1/f0), so there will be 2 pulses with f1 when bit is 1 and a zero signal when bit is 0. At the same time multiply the slow signal for the inverse of my binary serie, so when the bit is 0 it will become 1, and the slow signal will show one pulse and when bit is 1 it will become 0 and the signal will be zero. Combining this two signals I would get the modulated signal. 
Maybe this way its faster because you dont have to change the channel propierties on the fly but changing the signal itself and then outputing it. But I have no idea how to do this with the DAQmx functions.
(Sorry for my english, this is hard to explain.)
I am using NI DAQ 6363, forgot to say.
Attachments:
Lee txt y modula v0.24.vi ‏62 KB

Similar Messages

  • How do I configure a counter to generate pulses using DAQmx?

    How do I configure a counter to generate pulses using DAQmx?
    Is says in the DAQmx C reference help
    "CtrnInternalOutput—The signal at this internal terminal is where the pulsed or toggled output of the counter appears. The output of a counter pulses or toggles when the counter reaches terminal count. When counting down, the counter reaches terminal count when the count reaches zero. When counting up, the counter reaches terminal count when the counter rolls over. To configure the counter to toggle or generate pulses, use the Export Signal function/VI with Counter Output Event as the signal name."
    I've tried this but can't get it to work, I may have the parameters wrong or something. The DAQmxExportSignal() function is very unintuitive to me. Here is my counter config code...
    int ret = 0;
    ret = DAQmxCreateTask("",&task_);
    errorMsg(ret);
    if (ret != 0)
    throw ret;
    // Configure the counter
    ret = DAQmxCreateCOPulseChanTicks( task_, "Dev1/ctr0", "", "/Dev1/PFI8", DAQmx_Val_Low, 0, divider, divider );
    errorMsg(ret);
    ret = DAQmxCfgImplicitTiming( task_, DAQmx_Val_ContSamps, 1000 );
    errorMsg(ret);
    // Change to pulse mode
    ret = DAQmxExportSignal( task_, DAQmx_Val_CounterOutputEvent, "/Dev1/Ctr0InternalOutput" );
    errorMsg(ret);
    // Start the counter
    ret = DAQmxStartTask(task_);
    errorMsg(ret);
    The above code works fine, in toggle mode, if I just comment out the DAQmxExportSignal() part.
    HELP!!!
    Stefan

    The problem is due to the DAQmxExportSignal call.  By default, when you create a counter output pulse train task, the driver will automatically set the output of the counter to toggle when the count for each high ticks and low ticks expire.  The driver also automatically routes the signal present at Ctr0InternalOutput terminal (the output of the counter internal to the device) to the Ctr0Out terminal (the I/O pin available externally).  Using the line
     ret = DAQmxExportSignal( task_, DAQmx_Val_CounterOutputEvent, "/Dev1/Ctr0InternalOutput" );
    will tell the driver to tristate the Ctr0Out terminal and not output the signal to the external I/O pin.  Using the DAQmxExportSignal function is generally only useful if you want to route the signal to some other terminal internal to the board without having the output show up on the external connector, route the signal to some other external pin other than the default pin, or if you want to have the output show up at multiple locations. 
    If you want to change the output behavior from toggle to pulse, you need to use the DAQmxSetExportedCtrOutEventOutputBehavior function.  However, this is generally only useful if all you care about are edges (not the duty cycle of the pulse train), and you want to generate higher frequency signals.  For example, with a 20 MHz timebase as the source of your counter, you can only generate a 5 MHz pulse train by default.  This is because the minimum value for the low and high ticks parameter is 2 (20 MHz / 4 = 5 MHz).  By changing the output behavior form toggle to pulse, you can generate a pulse train at 10 MHz since the output is now pulsing instead of toggling.  However, the width of each pulse is not programmable so you will no longer have a 50% duty cycle signal.  I don't remember exactly what the width of each pulse is, but I believe it's in the neighborhood of 50 - 100 nanoseconds in width.  I hope this information helps.

  • Pulse modulated CW with PXI-5650 and PXI-6653

    Hello,
    I am trying to generate a pulse modulated CW signal with the PXI-5650 as the RF source and the PXI-6653 as the modulating signal. Basically I am trying to generate a simple radar waveform. It seems like this would be possible to use the Timing Module (6653) to turn the RF output on/off on the Signal Generator (5650), but I am not sure how to route signals from one to the other using LabView.
    Has anyone tried this or something similar before? Can anyone please offer some advice?
    Thanks!
    -John
    Solved!
    Go to Solution.

    Hi John,
    From reading your post, it sounds like you want to use your timing and sync card to turn the RF output on/off, in others words, On Off Keying. OOK modulation is a built-in feature to the 5650. For more information, you can navigate in the NI RF Signal Generators Help to Devices -> NI RF Signal Generators -> NI 5650/5651/5652 Overview -> Modulation Modes, and just click on Modulation Modes. 
    An example of this can also be found in the NI Example Finder by navigating to Help -> Find Examples... in LabVIEW and then navigating in the NI Example Finder to Hardware Input and Output -> Modular Instruments -> NI-RFSG -> Modulated Waveforms -> RFSG 565x Digital Modulation.vi.
    Regards,
    Jason L.
    Product Support Engineer
    National Instruments

  • How to Measure Frequency to RPM NI-DAQmx Tasks

    Hello,
    I am trying to measure frequency using NI DAQmx task and then convert this to an RPM if at all possible.
    I have the following hardware options at my disposal.
    I have SCXI 1126 Module along with a SCXI 1327 terminal, as well as a PXI 6289 Multifunction DAQ.
    I have wired in a mag sensor to ai7 on my 1126 and when I pass a metallic object I get a amplitude of 6  - 8  so I am able to read the mag sensor.
    What I am trying to do is to somehow convert this analog measurement into a RPM while only utilizing the NI DAQmx task.
    Any help would be appreciated.
    Tim
    Solved!
    Go to Solution.
    Attachments:
    Freq Set Up.jpg ‏2993 KB

    So I would select new in "Custom Scaling"
    Then would I select linear?
    Your calculations are simple but I am unsure if this would give me the desired result.  From my attachment I am seeing an input amplitude of 6 Hz for each pulse.  What I mean by this is that every time I bring a ferrous object near my mag pick up I get a pulse, this is what I was trying to illustrate in the attachment.  The analog pulse comes in a 6 Hz so I would simply multiple this pulse by 60 (assuming I get one pulse per rotation) to get RPM?
    How would this make sense if I only input one pulse for a long duration of time? 
    I have notice the amplitude of the pulse input increases with increased pulse frequency.  Does this mean the lowest RPM I can record is 360 RPM?  
    Tim

  • Aviod frequency time-out in DAQmx

    I'm trying to measure the frequency of a square-wave signal from a turbine flowmeter. The flowmeter is installed in a complex system of valves, pumps, and other sensors. I have created a main VI in LV 7 which controlls this system as well as acquires data from all the sensors (mostly attached to NI-DAQmx hardware). This Vi is basically a large while loop that operates continuously until the user terminates it. The flowmeter pulse is to be measured by a single counter on a 6061E board configured by NI-DAQmx single low frequency tasks.
    I have configured the task in MAX with a hi limit of 5kHz and a low limit of whatever the default is for the 10kHz time base (I think around 0.02Hz) and connected the signal to PFI4 (for counter 1) a
    s instructed. My flowmeter's frequency varies from 0 to 3kHz. Since my system's flow rate is zero upon start-up of my main VI, the frequency measurement task times out, producing an error message, shutting down the VI.
    Is there any way to measure my flowmeter's signal without these time-out troubles? I can't seem to find any period or frequency measurement examples that allow the signal to go to zero without creating some sort of error.
    Thanks,
    Tom

    You have two options. The first is to wire a -1 into the timeout input of the Read VI (see attached picture). This is equivalent to an infinite timeout and will cause the driver to poll the number of samples available for reading until the requested amount of data has been transferred. The driver does yield inside of this polling loop, but it may still utilize more CPU than desired for your application.
    If CPU utilization becomes an issue, you can query the Available Samples Per Channel attribute in the Read Property node (see attached picture) in your while loop instead of directly calling the Read VI. Once the available samples has reached the desired threshold, you can call the Read VI without having to worry about timeouts or blocking waiting for da
    ta. This will also allow you the opportunity to introduce a sleep time in your loop to reduce CPU utilization.
    Attachments:
    Read.JPG ‏8 KB

  • How to change the frequency of pulse train on the fly using an array of values?

    Hi all!
    First I want to thank U for the great job you are doing for this forum.
    Iam still busy trying to control a stepper motor, by sending pulses from my E-series 6024 to a compumotor s6- stepper Driver. I've managed to get it working. I desperately need to control the motor using the values from an array. I believe we can use two approaches for that:
    1st - I can get an array of the "numbers of pulses". Each element must run for 10 milliseconds. Using that we can calculate the array of frequencies to send the number of pulses within 10 milliseconds for each specific element. Could we use the arrays of "number of pulses" and frequencies in a "finite pulse train " and up
    date with each element every 10 millisecond?
    2nd - Or Could we use of the frequency array in a "continuous pulse train vi" and update it every 10 milliseconds?
    Please note that I must use the values as they are.
    Can someone please built a good example for me? Your help will be appreciated.
    Regards
    Chris
    Attachments:
    number_of_steps.txt ‏17 KB
    frequency.txt ‏15 KB

    Tiano,
    I will try to better explain the paragraph on LabVIEW. The original paragraph reads ...
    "While in a loop for continuous pulse train generation, make two calls to Counter Set Attribute.vi to set the values for "pulse spec 1" (constant 14) and "pulse spec 2" (constant 15). Following these calls you would make a call to Counter Control.vi with the control code set to "switch cycle" (constant 7). The attached LabVIEW programs demonstrate this flow."
    You can make two calls to Counter Set Attribute or you can make a call to Set Pulse Specs which, if you open this VI, you will see that it is just making two calls to Counter Set Attribute. What you are doing with the Counter Set Attribute VIs is setting two registers called "pulse s
    pec 1" and "pulse spec 2". These two registers are used to configure the frequency and duty cycle of your output frequency.
    The example program which is attached to this Knowledge Base demonstrates how to change the frequency of a continuous generation on the fly. Why continuous? Because changing the frequency of a finite train would be easy. When the train completes it's finite generation you would just change the frequency and run a finite train again. You would not care about the time delay due to reconfiguration of the counter.
    If you would like to change the frequency of the pulse train using a knob, this functionality will have to be added in the while loop. The while loop will be continuously checking for the new value of the knob and using the knob value to set the pulse specs.
    LabVIEW is a language, and as with learning all new languages (spoken or programatic) there is a lot of learning to be accomplished. The great thing is that LabVIEW is much easier than mo
    st languages and the learning curve should be much smaller. Don't fret, you'll be an expert before you know it. Especially since you're tackling a challenging first project.
    Regards,
    Justin Britten

  • Increase Frequency of Pulse Generation

    Hi all,
    i'm using a NI PCI 6229 to generate by its counter  a trigger for a strobo lamp..
    actually i'm using the Gen DIG Pulse TRAIN continuos.vi that could reach freq till a maximum of 100 HZ
    SInce the lamp could work at higher Freqs, i would like to know how to increase the freq in that vi.
    TIA,
    Thescar.

    Hi thescar,
    Ar you sure it only works till 100Hz???????????????????? It will work much faster... How are you measuring it? probably it is a problem with the way you are observing those readings.
    Anyway you can generate pulses by 3 ways:
    1. Introducing frequency
    2. Introducing period
    3. Introducing ticks
    The 3rd way you can select the numer of ticks the pulse is at low level and the number to high level. You also need to say which is the source for the ticks and here you can select (also anothers but i recommend you chose one of these) the 1Khz timebase, the 100Khz timebase and the 20Mhz timebase.
    So, for example if you select as source 1Khz timebase and 2 ticks at low level and 2 at high level you will be obtaining a pulse of 1Khz/4=250Hz. With all those possible configurations you will be able to set very different frecuencies over 100 Hz.
    Regards,
    Jaime Cabrera
    NI Applications Engineering
    Regards,
    Jaime Cabrera
    NI Applications Engineering Spain

  • Frequency divider/ pulse generation from 1 to n

    Hi,
    I have a sample pulse which in some cases needs to be divided. I tried to use the pulse train generation function, which works fine (giving me a pulse every n sample pulses), but only starting at 2 input pulses. I need to be able to use this function from a division of 1 and up.
    Put in another way, can a counter be configured in such a way that it outputs a pulse every rising edge of the source signal?
    I'm using a PXI 6602 counter card and am programming it through calls to NIDAQ32.DLL under Labview 7.

    Hi Walter,
    In short, no. You can't output a pulse on every input pulse. You can however configure the degree of division. Here are the rules for division:
    When set to pulse train generation, you will have a register for the low value of the pulse train and a register for the high value. What happens in typical pulse generation is that these registers are loaded with count values such as 2 and 2 for each register respectively. In default operation, the first register will count 2 pulses on the source and then toggle the output. The second register will then count to pulses and toggle the output again. The operation then cycles back to the first register. This toggling effectively creates a pulse train that is divided by 4 and a duty cycle of 50%.
    You can however change the output mode to pulse instead of toggling upon completion of counting on a register. In the above example, you would count 2 source edges and then pulse for the first register and the count 2 more edges and pulse again for the second register. You will of course repeat this in pulse train generation mode. This mode allows you to obtain greater resolution since you are now dividing by 2 but your duty cycle will be different. Each pulsed output will be equivalent in size to the source pulse width.
    Finally, the two registers can be populated with integer values of 2 or greater. Therefore, the smallest frequency division is 2.
    You will have to work with these three elements to obtain the pulse train of your desired frequency. Hope that helps. Have a good day.
    Ron
    Applications Engineering
    National Instruments

  • NI Scope FFT frequency shift

    Hi,
    I use a DAC card (NI PXI/PCI-5401) to generate a sinus and a ADC card (NI-PCI-5911) to pickup this sinus. To transform the time domain sinus signal into a frequency domain signal, I have used an example of NI using the NI-Scope vi "Add process" with FFT.   Somehow, the sinus generated at 50kHz is shown in the frequency domain at a frequency of approximately 58kHz. I don't understand this shift. Would you have an idea? Both vis used are attached
    Best,
    Ninskaya
    Attachments:
    Data Acquisition Mult.no.vi ‏206 KB

    Hi Ninskaya!
    What happens if you try higher or lower frequencies?
    Best regards,
    Hendrik
    Message Edited by Honsel on 05-30-2006 08:24 AM

  • Frequency each pulse on sound card

    " I am trying enters a square sign (of encoder), the sound card filters the waves of high frequency and therefore he lacks labview information to show the perfect sign. But I believe that it is not necessary, that the sign is perfect to calculate the frequency of each pulse. Is it this way?. I alone want to know the frequency of each pulse. I don't care amplitude.
    I have tried to calculate the frequency of each pulse. I have recorded the sign and once saved. I have tried to calculate counting the pulses, with the option ' indices', subtracting at the 2º -1º, 3º-2º,... .
    but this is not accurate because the sample rate is to 44100 hz and I use signs from 50 hz to 10khz. To high frequency it counts very few points, to 10 khz it co
    unts 4 and this is not accurate.
    Is there some form of calculating it more accurate?. What vi's can I use?.
    Thank you!."

    Well, if I understand what you're saying. You are trying to read the frequency of a squarewave coming from an encoder. The problem with doing this with a DAQ card is (to put it simply) the required Nyquist samplng rate. Think for a moment, what is the frequency content of a squarewave? The fundamental (which is what you want) and a theoretically infinite number of harmonics. To adequately sample a squarewave and correctly represent the vertical edges would require an infinitely high sample rate.
    If what you need is to measure the squarewave repetition rate, doing it with a DAQ card (or sound card) is the wrong way to do it. What you need is to do a pulse width measurement using a counter.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Counter miss TELL pulses, NI DAQmx 9181 with NI 9402

    Hi,
    I am trying to read TTL pulses from a function generator using a counter. I am applying a 1KHz signal to the counter. Every time counter reads the pulses correctly in first cycle of measurement, but it miss some counts in all following cycles.
    I am using NI cDAQ 9181 Chassis and NI 9402 module with LabVIEW 2014 and NI Max 14.0.
    My computer has Windows 8.1 operating system.
    Please find the attached VI and images of Front Panel after run.
    What could be the reason for that, please guide.
    Thanks !
    B. Sharma
    Attachments:
    Counter cDAQ Testing-LV 2014.vi ‏44 KB
    Counter cDAQ Testing-LV 2014_Front Panel.png ‏68 KB
    Counter cDAQ Testing-LV 2014_Block Diagram.png ‏70 KB

    1.  The Elapsed Time VI starts counting when you first call it, so the first loop will take about the desired amount of time (although OS timing is not very reliable anyway).  The Express VI will reset itself as soon as you hit the time target.  Then, you wrap back around and reconfigure your task.  This takes time (during which the DAQ task is not counting, but the Elapsed Time VI has already been reset), and so all subsequent acquisitions will actually run some time less.  For example, if the configuration took 100 ms and you wanted to acquire 1 second of data, you would only get ~90% of the count.
    2.  The time it takes to reconfigure the task is going to vary dramatically with the bus you are using due to latency (ethernet > USB > PCI/PCIe).  So it makes sense that the problem was not noticeable with PCI, and it was most severe with ethernet (9181) compared to USB (9171).
    3.  Discarding the first sample on buffered counter measurements is a behavior change with STC3-based DAQ products (e.g. X Series, C Series, 621x) compared to older NI DAQ products (e.g. E Series, M Series, 9172).  In your case, when you use the E Series card the first measurement represents the count measured between the arming of the task and the first edge of the gating counter (which toggles almost immediately, you are very unlikely to receive an external 1 kHz clock edge during this time).  Since this measurement is often not desired and can be confusing, it is discarded in the newer NI hardware.
    Here is the behavior from the M Series and X Series user manuals (I know not your exact hardware, but I know that the diagrams are in these manuals and your E Series and cDAQ systems respectively will behave the same).
    From M Series User Manual:
    From X Series User Manual:
    Best Regards,
    John Passiak

  • How can i get frequency of the modulated signal

    All my questions are showed in the picture.
    Attachments:
    xxxx.jpg ‏39 KB

    "Well, since it is for a "friend"...
    An FFT (or Power Spectrum) will tell you all of the fundamental frequencies of your signal. This is pretty easy and there are functions in LabVIEW to do this. However, since you are only trying to determine the frequency of one square wave mixed with many sine waves, you can just look at the first dirivitive of the signal (dS/dt) and look for discontinuities (dS/dt = +/- Inf). This discontinuity is only due to the square wave signal component. Find the frequency of the discontinuities of the first dirivitive and you have your answer.
    -Jim"

  • Phase Shift Key : Modulation toolkit

    I am trying to simulate a phase shift key, I followed one NI example. the example worked fine, and I used the same code but my didi not work. The number of symbol is not correct.
    I have attached the VI , I could not figure out what the problem was. The constellation graph should remain constant, rather that moving , and the number of symbol in the graph should be equal to the number of symbol on the control.
    Thanks for any help.
    Solved!
    Go to Solution.
    Attachments:
    psk.vi ‏26 KB

    Hello ade77
    Thanks for your post. It looks like your  Eb/NO (10 dB) value is not high enough to get the right number of symbols in the right place. Try increasing this number and see if that helps. See the screen shot of your code attached. 
    Let us know if this helps!
    Cheers!
    Corby_B
    http://www.ni.com/support
    Attachments:
    psk.jpg ‏142 KB

  • Frequency Shift Keying

    In Traditional Nidaq, ND_APPLICATION = ND_FSK meant that the delay and duration of the pulse could be gated. The help files say FSK is not implemented in nidaqmx? Does anyone have a suggestion on how to mimic this behavior? is NI going to build FSK into the next version of NIDAQmx?
    Thanks,
    Brady

    Please see this thread:
    http://forums.ni.com/ni/board/message?board.id=250&message.id=11743
    -Alan A.

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

Maybe you are looking for