Simple sine

Hi it is me again.
Let me explain better what Im trying to do. Im trying to create a modulation (qpsk), but I dont want to use the MT Modulation toolkit, because I'm trying to creat it spte byt step.
1 Step: To create a bit stream 8 bits... (done it)
2 Step: Slit the bit stream in groups of 2 bits ( done it)
3 Step: Then the 2 bits are divided. One "goes" trough the Channel I (in phase) and the other goes troug the Channel Q (in quadrature). (done it)
4 Step: Each bit changes its value, 1 logic= +1 and 0 logic = -1 It means that if bit valued 1 goes trough channel I its changes its value to +1, and if its is a 0, it changes its value to -1, and the same for the channel Q ( done it)
5 Step: Every bit that goes trough channel I must be multiply by a Sin (wct), so the posible answers comming from Channel I are: +Sin (wct) or - Sin (wct), and every bit that goes trough channel Q must be multiply by a Cos (wct), so the possible answers are +cos(wct) or - cos(wct).
6 Step: Add the answers of every channel. The possible answers are:
+sin(wct)+cos(wct)
+sin(wct)-cos(wct)
-sin(wct)+cos(wct)
-sin(wct)-cos(wct)
By doing all this, I have created a qpsk modulation.
I have done this by creating a sine wave and a cosine wave.... and then multiply each by -1 or +1 and add them... and it works, but what I want to know is if I could do it diferently because I would like to see the answers or the combinations exactly like e.g sin(wct)+cos(wct).... The reason I want this, is becasuse afterwards I have to demodulate.....
To demodulate:
Each combination (sen+cos, sen-cos, etc...) goes, at the same time, again troug a channel I and a channel Q, the combiantion trough channel I, multiplies itself, again for sin(wct), and in channel Q for cos (wct)
example
Combination: -Sin(wct)+Cos(wct)
Channel I: (-sin(wct)+cos(wct))*(sin(wct))
Channel Q: (-sin(wct)+cos(wct))*(cos(wct))
Matematically:
(-sinwct+coswt)(sinwct)=
(-sinwct)(sinwct)+(coswct)(sinwct)=
-sin^2(wct)+ (coswct)(sinwct)=
-1/2(1-coswct)+1/2sen(wc+wc)t+1/2sen(wc-wc)t
so channel I = -1/2+1/2cos2wct+1/2sen2wct+1/2sen0...
after filtering 1/2cos2wct+1/2sen2wct and 1/2 sen0 = 0
The answer is -1/2= 0 logic... or a bit value 0.... it the answer where 1/2 = 1 logic or bit valued 1
That is what I would like to create.. I dont mind about frecuency or wct does not have a especific value... I just want to be able of doing this. I have done it with waves but at the time of demodulait, it does not work the way I would like.
Please I hope someone can help me!

All of that can be done in LabVIEW.
You need to be careful about keeping track of array indexing since the modulation (I and Q data) arrays may have far fewer elements than the carrier {sin(wct) and cos(wct)} arrays.
I put together a simple demonstration.  It needs some cleaning up at the output.  I was not particularly careful about preallocating buffer for arrays, so this works OK for small datasets but may not scale well.
It is also not documented well.  The for loops on the left generate the bit streams and do the I and Q modulation.  On the right the multipliers and filters demodulate the carriers and the while loops decode the result.
Change the noise levels and the filter frequency to see the effects.
Lynn 
Note: I had to add a .txt extension to the file so it would attach.  Please remove that before opening it. 
Attachments:
I Q modulator.vi.txt ‏59 KB

Similar Messages

  • Unable to generate sine wave

    Hello everyone!
    I am currently working on my Bachelor project at a company. i am stuck with a problem.
    I have designed a labview program for vibration test system. I have used cRIO 9076 as the controller with NI 9263(as D/A) and NI 9234(as A/D).
    The loop works as follows. the input is given from the labview program. it is then sent to the cRIO. the output of CRIO(that is output from NI 9263) is given to the amplifier. the vibration shaker vibrates based on the input from aamplifier. then the accelerometer detects the vibration and sends it to the NI 9234 and loop repeats iteratively. since i have designed a sweep sine vibration system, the output of cRIO is a square wave. it should be sine wave.
    the probelm is i am getting a square wave as output from my NI 9263 which should be a sine wave output. I have two subVI where i use nominal to binary convertor(for NI 9234) and binary to nominal (for NI 9263) as calibration mechanism. 
    the question is where have i went wrong? what should I do to get a sine wave? 
    PS: on searching NI i found out some formulas (to generate sine wave) and designed a FPGA and LabVIEW program to generate a simple sine wave and got a sine wave. if that formulas is to be included where should i include that?
    Thanks in advance.
    Regards,
    Vishal.

    Without seeing your current code, there is no way we can even uess as to why you are creating a square wave instead of a sine wave.

  • Storing multiple Sine waves in one LVM

    Hi all,
    actually i got a very short question. I can't believe that i'm unable to fix the problem by my own... But that's the way it's suppose to be I think.
    The question:
    Just a simple Sine wave in a while loop, connected to a graph. When I run it i see a lot of different Sines in the graph window, let's say 100 sine waves. How can I write this data from ALL THE 100 SINE WAVES to 1 LVM?
    When i store the data right now I only see 1 Sine Wave and not all the waves i've seen in the graph window.
    I hope somebody can help me with this. Cause this is just a simple example of a very complicated programm i'm working on.
    Thanx for spending time on this stupid problem!

    Could you post your VIs?  I am not sure what you are talking about.
    Thanks,
    Bob Young
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

  • Creating a Sine Wave Chart with Continue if True

    Hello, 
    I want to create a simple sine wave chart using a while loop and using the continue if true mode. I want to use a Not icon to accomplish this. I also need to have a stop button that a user can press to terminate the process. I have attached my initial sine wave chart using the stop if true and my attempt at accomplising the continue if true. 
    Thanks for any help! 
     

    It sounds like you want the loop to continue if the stop button is NOT pushed.  Does this give you a hint about how to write your program?

  • How to create sine wave?

    How do you create a simple sine wave in Logic, and how do you change the frequency?
    Logic noob deluxe

    Try the Bitcrusher plugin.
    But, dude, I get the feeling that to indulge yourself in your noob-ism will wear very thin very quick, and if your next question is where the Bitcrusher is and where you have to click and then how you can use it and what the controls do and after that how you can record what it does, then it might happen that noone will bother to read anymore let alone reply.
    We can hold your hand only so far and ultimately you must decide on your own where to click, what to try and when to think.
    How about getting some 1:1 tuition to get you up and running ? It's infinitely easier for one person sitting next to you than for a bunch of folks scattered allover the globe which try to read your mind.
    Christian

  • When i would like to send the sine wave to osilloscop​e

    when i send this sine, to osilloscope, i dont get a simple sine but with a delay. in my VI i already changed the units of timer from 50 to 500, but no no change. why it is like this? can somebody please tell me? i am attaching the VI thanks
    Attachments:
    041005_functiongenerator.vi ‏197 KB

    Dear Sebastian
    In the same Vi you have seen that i want to send 128 periods to oscilloscope. some times i want to send 4 periods and some times may be about 1 million periods.
    now what i want is if i send 128 periods to osilloscope,it must display these 128 periods/cycles and then stop, if i send 1 million periods, then it display 1 million periods and then stop. if i break
    some where in between then afterwards when i resume, it must dsplay/generate the rest of the periods on osilloscope. i know at Ao start we can not break, resume any more, because then it not in our control any more, but i think this break resume is possible before Ao write just after creating wave array or when Ao write is writing in buffer.but i dont know how to implement it? any hel
    p would be appreciated.
    thanks

  • Help on autocorrelation

    Hi all, I am doing a project on Heart sound.I am suppose to come up
    with a display showing a real time Heart sound,FFT and Heart Rate.I am
    using NI USB 6008 to collect the data frm my hardware unit.I Managed to
    get all the others except Heart rate.I was told to use auto correlation
    to estimate the heart rate from the Heart sound.I have some problem
    with auto correlation.Anybody can help me troubleshoot my source code
    for me?. I really appreciate ur help.Thanks
    Here,I ve attached my source code.Pls troubleshoot .I have to submitthis project  by this week
    Attachments:
    heartsound.vi ‏490 KB

    In the frequency domain, the Hilbert transform changes the sign of the
    frequency content on the negative side of the spectrum.  The
    simplest example is sine/cosine.  The Hilbert transform of a sine
    wave is a cosine wave and vice versa.  These signals together are
    considered a Hilbert pair.  Just like in the simple sine/cosine
    case, where cos^2 + sin^2 = 1, the same is true for any Hilbert pair.
    Since any signal can be represented as a sum of sines and cosines, then
    the Hilbert transform will generate a signal where each sine is matches
    with a cosine function and every cosine function is matches with a sine
    function.  So if you take your original signal and make it the
    real part of a complex signal and take the Hilbert transformed signal
    and make it the imaginary part of a complex signal (the form is called
    an 'analytic signal'), then the resulting magnitude signal should be
    easier to deal with when trying to do peak detection, which is the
    whole point of the process.
    Randall Pursley

  • Create a LabVIEW Based Virtual Instrument for NI Multisim - Missing Function?

    Hi there,
    I am trying to build an output instrument for NI Multisim according to the instructions here:
    http://zone.ni.com/devzone/cda/tut/p/id/5635#toc3
    The problem is that i cannot find the function i see labeled as "Gen Signal" anywhere in my Labview version (8.5) so i can
    use it in the "Update Initial Output Data"case box! 
    Excuse my ignorance, but i am new to LabView and unfortunately in electronic schematics as well.I am doing this project for my school assignment.
    Is it available in another Labview version, or can you tell me where i can spot it so i can build my VI?
    Thanks in advance.  I hope i posted on the right section...

    234123410…
    Here is a very simple output example that you can start with.   Likely you are still having issues with either the build settings or something with one of the subVIs that is not properly being included for some reason.   I do notice that sometimes when a waveform VI from the Signal Processing Pallette that originally is coming from the NI_MABase.lvlib, it can sometimes have issues with the inclusion / build settings.  This seems to be an issue with the LabVIEW project build and not necessarily with the Multisim interface. 
    So lets take a simple example as shown here...
    The two core source files are "SimpleOutputInstrument.lvproj" and "SimpleOutputInstrument.llb".    The .llb contains the "Simple Output Instrument.vit" - which is the main VI, "Simple Output Instrument_multisimInformation.vi" which is the Multisim information VI to set the pins and Instrument name and "Simple Sine Waveform.vi" which is a simpler form of a sine wave generator (not using the NI_MABase.lvlib).
    Using the .lvproj file, build the project as an .llb.   The result is "sines.llb" which needs to be placed in the lvinstruments folder C:\Program Files\National Instruments\Circuit Design Suite 10.1\lvinstruments...
    See if you can run this VI and then try to build the .llb with my same source VIs and let me know the results.
    Best Regards,
    Patrick Noonan
    Business Development Manager
    National Instruments - Electronics Workbench Group
    50 Market St. 1-A
    S. Portland, ME 04106
    Email: [email protected]
    Tel. (207) 892-9130
    Attachments:
    SimpleOutputInstrument.lvproj ‏4 KB
    SimpleOutputInstrument.llb ‏74 KB
    sines.llb ‏74 KB

  • Cannot run Simulink dll at the same time as running real-time target VI

    Hello
    What I am trying to do is run a model dll created in Simulink to control some servo's through a CompactRio 9014. 
    At the moment I have managed to create three VIs
    1) In the FPGA target that performs the PWM on a desired channel
    2) That takes the value of a network variable which contains the position required and feeds that to the 1st VI
    3) A VI that runs on the host computer that modifies the value of the network variable to change the position
    I can get these three VIs working and the servo controlled, but when I try to update the value of the network variable using the simulation, by deploying the simulation to the RT target and running it, it says
    'Access denied: This target is already in use by another project or host computer.'
    I assume as this is because the project is already connected to the cRio, so I disconnect and am able to deploy the model files. 
    However when I try to run one of the VIs in the RT Targer along with the simulation I get the error:
    'This VI is downloaded on the target but is not present in the project you are attempting to deploy.  All VIs on the target will be closed unless you choose to add the missing VI to the project.'
    With a large number of missing VIs...
    Would I be doing this wrong, i.e. is there a much simplier way to control the FPGA inputs using the simulation, or is there something I could have missed?
    Thanks
    Geoff
    Solved!
    Go to Solution.

    Hi Geoff,
    It seems that you are on the right track except for some concepts that I
    want to review:
    A CompactRIO or cRIO has 3 different components:
    1)     
    Real-Time controller (in your case a 9014)
    2)     
    FPGA backplane (this could be a 9102, or a 9103, 910x,
    etc)
    3)     
    I/O modules (like a 9401, 9263, etc)
    When you write an application for cRIO you usually have three different VIs:
    1)     
    Host VI – This VI is used as a user interface and runs in
    Windows (under “My Computer” in the LabVIEW project) This VI is optional because
    you might want to run the cRIO headless.
    2)     
    RT VI – This is the VI that runs in the cRIO controller
    (in your case the 9014).  This VI lives
    under the cRIO target in your LabVIEW project. 
    3)     
    FPGA VI – This is the VI that runs in the cRIO
    backplane like a 9102.  This lives under
    the cRIO >> FPGA target in the LabVIEW project.
    The ONE application that I was talking about in my last post is for the RT
    VI.  There can only be one RT VI that
    gets deployed.  If you want to run
    multiple VIs in the cRIO RT, then you need to run those VIs as subVIs of one
    top level VI.
    LabVIEW Simulation Interface Toolkit (SIT) has a tool called the SIT
    Connection Manager that creates two of these three VIs for you (the RT and the
    Host VIs).
    Please refer to the following link about the SIT Help.  Go to the How To section.  It is organized in a kind of step by step
    tutorial.
    http://zone.ni.com/reference/en-XX/help/371504D-01/
    In your case it is going to be a bit more difficult because of two things:
    One, you are using a VxWorks target. 
    Two, you want to use your own FPGA VI.
    Let’s address each one of them:
    1)     
    VxWorks target- To use the SIT Connection Manager you
    need to use a DLL not an OUT file, even though you need the OUT file for the cRIO VxWorks target.  The reason is
    that this tool needs to read the compiled model to know what the
    parameters, signals, inports and outports of your model are.  Because the tool runs in Windows you cannot
    open an OUT file (meant for a different OS) so you need to give it a DLL. 
    For this reason you will need to compile your model file into an OUT
    file and a DLL.  Once you give a DLL to
    the Connection Manager and you select your cRIO as the execution target, keep
    doing the rest of the steps as the help says. 
    LabVIEW will identify that you are using a VxWorks target and will
    download the OUT file to the cRIO.
    2)     
    Custom FPGA VI – LabVIEW SIT has some FPGA bitfiles
    (compiled FPGA VIs) that it can use. 
    When you open the SIT connection manager and go to the Hardware IO
    mapping section it asks you to select the bitfile.  If you want, you can select one of the
    shipping bitfiles but iIf you
    want to use your own, then you will need to do some changes to your FPGA VI , recompile it and
    save the bitfile in a specific location with a specific name.
    Please refer to the following link for
    instructions on how to create your custom FPGA VI:
    http://zone.ni.com/reference/en-XX/help/371504D-01/lvsithowto/sit_h_custfpga/
    What I would suggest is that you start with a very simple example and using
    one of the shipping bitfiles.  Look into
    the following path for a very simple Sine wave generation example:
    C:\Program Files\National Instruments\LabVIEW 8.6\examples\Simulation
    Interface\Sine Wave
    Because you are running a VxWorks target you will need to recompile this
    example model sinewave.mdl to an OUT file.
    To get a better understanding of what SIT does you might
    want to check some quick videos. Go to
    http://sine.ni.com/nips/cds/view/p/lang/en/nid/11763  and under the
    resources tab there are two videos called Demo - <something>...
    Hope this helps and let me know if you have more questions.
    Ricardo
    National InstrumentsSystems Engineering

  • Could not complete the new 3D extrusion because the path is too complex

    I'm using Photoshop CS6 in Windows 7 64bit. I've seen other posts about a bug if you are trying to complete a 3D extrusion when a triangle is present, but my issue seems even more basic.
    I'm drawing a simple wave shape with the pen tool set to shape, no fill, 1px stroke. I'm simply drawing three points to create a simple sine wave - the idea being to create a wavy piece of 35mm film. The image size is quite big - 6000 x 4000 px. The first time I did it, the rendering worked fine but I didn't like the curve I had drawn, so I stepped back and tried again. Now, whatever I do, I get the "Could not complete because the path is too complex" message.
    Is this a known bug and are there any workarounds to create a single pixel wide wavy shape in 3D that looks like a piece of film.
    Steve

    I have run across this also, but my path was more complex.  As far as creating a single pixel wavy shap, I would use the depth map 3D feature of  converting a depth map to a plane.  Create a gradient in 32bit mode, so the transistion are smooth, and then go to the 3D menu and select new mesh from depth map>plane.  You can later go in and edit the depth map to tweak it.

  • Synchronizing function generator outputs

    I am a grad student learning Labview for use in research.  What I am trying to do right now is figure out how to sync up two function generators that are generating a simple sine wave output.  I am using a stanford research systems ds345.  I setup the code so that each machine is set to an external clock and I have attached the corresponding cables on the machines to sync up their clocks, but I am still not seeing a good synchronization of the phases of the waves.  I have attached my simple practice code and I would appreciate any suggestions with this.
    My ultimate goal here is to create a program that is turning the two sine waves on and off in sync (or real close to it) while having the sine waves being in opposite phase with each other.  The frequency of the waves will also be changing to different values when the sine waves are turned back on.
    Attachments:
    Practice.vi ‏53 KB

    Ace02,
    I believe that you are missing triggers for your waveform generation.  Triggering would allow you to match up phases the way your application requires.  Looking at your current code, I can't see any triggering set up, so right now there is no way to determine phase, all you have set is a sample clock.  I haven't used that particular instrument myself, so I can't comment on how to actually configure triggering, but I would recommend looking into that.
    Regards,
    Ben
    National Instruments
    Certified LabVIEW Associate Developer
    Certified TestStand Developer

  • Life size plotting of XY data

    Hi,
    We have a system that does surface scan of components to generate cross section profile. The width and height data is then shown on an XY graph. On the XY graph, X-axis represents width of a component and Y-axis represents gauge (or thickness). We take this graph as .jpg into our MS Word report (attached as "TEST REPORT.doc").
    From the report it can be seen that the cross section profile has been made to fit the graph area (and thus it is not 1:1 size of the component under test).
    Our question: How do we take a life size printout of this data. In the attached example, the component is nearly 225mm wide and max height is upto 13mm.
    We are using LV 7.1 with Report Generation Toolkit and Database Connectivity Toolkit. OS is Win2000 Prof.
    An early answer will be appreciated.
    Thanks,
    Gurdas
    Gurdas Singh
    PhD. Candidate | Civil Engineering | NCSU.edu
    Attachments:
    TEST REPORT.doc ‏46 KB

    You are not limited to your screen size when you resize the graph for export. Determine how many pixels wide and high you want your final plot on the page (look at your printer resolution), then set the graph that size. Grab the image and post it to Word. The attached VI shows the first part of this process by saving a PNG of a simple sine wave at a size larger than most screen resolutions (3000x1500). In use, I did not see the graph resize, but the image was the correct size. My screen resolution was 2560x1024 (dual monitor) when I did the test.
    Good luck.
    This account is no longer active. Contact ShadesOfGray for current posts and information.
    Attachments:
    TestSaveLargeControlImage.vi ‏43 KB

  • Spectrum analyzer!

    I am trying to make a spectrum analyzer visualization, from sound samples, so I decided to use fast fourier transform to solve it, and here is the code i found on the internet.
    public final float[] fftMag(float[] x,int len) {
    // assume n is a power of 2
    n = len;
    nu = (int)(Math.log(n)/Math.log(2));
    int n2 = n/2;
    int nu1 = nu - 1;
    float[] xre = new float[n];
    float[] xim = new float[n];
    float[] mag = new float[n2];
    float tr, ti, p, arg, c, s;
    for (int i = 0; i < n; i++) {
    xre[i] = x;
    xim[i] = 0.0f;
    int k = 0;
    for (int l = 1; l <= nu; l++) {
    while (k < n) {
    for (int i = 1; i <= n2; i++) {
    p = bitrev (k >> nu1);
    arg = 2 * (float) Math.PI * p / n;
    c = (float) Math.cos (arg);
    s = (float) Math.sin (arg);
    tr = xre[k+n2]*c + xim[k+n2]*s;
    ti = xim[k+n2]*c - xre[k+n2]*s;
    xre[k+n2] = xre[k] - tr;
    xim[k+n2] = xim[k] - ti;
    xre[k] += tr;
    xim[k] += ti;
    k++;
    k += n2;
    k = 0;
    nu1--;
    n2 = n2/2;
    k = 0;
    int r;
    while (k < n) {
    r = bitrev (k);
    if (r > k) {
    tr = xre[k];
    ti = xim[k];
    xre[k] = xre[r];
    xim[k] = xim[r];
    xre[r] = tr;
    xim[r] = ti;
    k++;
    mag[0] = (float) (Math.sqrt(xre[0]*xre[0] + xim[0]*xim[0]))/n;
    for (int i = 1; i < n/2; i++)
    mag[i]= 2 * (float) (Math.sqrt(xre[i]*xre[i] + xim[i]*xim[i]))/n;
    return mag;
    but the spectrum looks wrong.

    Hi,
    You don't show enough of your program for anyone to make a guess at what is wrong! You don't even say what is wrong!
    Did you test the FFT you downloaded? Did you test your code on a simple 'sin' wave? It should only take you 15 minutes to write a test of the FFT.
    Roger

  • Speedy 33 background noise

    Hello,
    We are finishing a project with the Speedy-33. The analog outputs are connected to a small amplifier for headphone listening. When connecting headphones directly to the Speedy-33 output or to the headphone amplifier, a background noise is heard : it sound like a tone. As you can imagine the amplifier jsut make it more audible. But the tone is present even without the amplifier ... so it is clearly from the speedy-33 output.
    The speedy-33 is running in standalone mode ... as the USB connection tends to make a huge amount of noise.
    We tried to listen to the Speedy-33 in "full bypass" (the labview patch is the mere connection of the input to the output) ... in that case only, their is no noise. As soon as we put any processing (exemple: we tested a single biquad between the outs and the ins) ... we get the famous background tone.
    Any information about Speedy-33 background noise ... caused by the DSP or any other component on the board? Any advice?
    Many thanks,

    Thanks to all !
    The main trouble is that when connecting directly the inputs to the outputs, the noise is not there. When a process is added between the input and the output (like a simple biquad as mentioned by PaGauthier), the board is generating a "sine" background noise.
    In our application, the speedy is running in standalone mode using a DC power supply. The power suply was changed twice to make sure that it was not a noise coming from it (we used an analog regulated one, and a switching one with the same results)
    The inputs are feeded with simple electret preamp using transistors or opamps (we have two preamps because we were thinking that is was radio frequencies interferences). The bandwidth of the preamp is quite large but the capsule itself is limited to 20kHz... and once again, when there is no process between the inputs dans the outputs, no background noise is added.
    I have a simple question : Is there an aliasing filter onboard for each input ? If yes, I hope that designers did not simply added those filters at the nyquist frequency... In most cases, 80 to 90 % of the nyquist frequency is better... This could explain a 400Hz of aliasing : but couldn't explain that the added noise is a simple sine.
    PaGautier and I will test the board next week to make it clear about aliasing filters.
    Thank you for your help.
    Yann

  • PXI-5421, C++, Creating output signal, DAQmxWriteAnalogF64 fails

    I want to create a simple sine wave output on a PXI-5421 card. I have looked at the sample projects for DAQmx, and based an application on them.
    The application falls over at the call to DAQmxWriteAnalogF64 using the following parameters:
    lReturn = DAQmxWriteAnalogF64(
    m_hTask,
    1000,
    0,
    10.0,
    DAQmx_Val_GroupByChannel,
    data,
    &lWritten,
    NULL
    What am I doing wrong?
    Below is the output of the application, and the code.
    ***** START OF OUTPUT *****
    DAQmxResetDevice -> SUCCESS
    DAQmxCreateTask -> SUCCESS
    DAQmxCreateAOVoltageChan -> SUCCESS
    DAQmxCfgSampClkTiming -> SUCCESS
    Samples per channel written: 0
    Source terminal to be routed could not be found on the device.
    Make sure the terminal name is valid for the specified device. Refer to Measurement & Automation Explorer for valid terminal names.
    Device: PXI1Slot3
    Property: DAQmx_SampClk_Src
    Source Terminal:
    Task Name: _unnamedTask<0>
    Status Code: -200040
    DAQmxWriteAnalogF64 -> -200040
    ***** END OF OUTPUT *****
    ***** START OF APPLICATION *****
    void Startup( void )
    // get amplitude
    double dblAmplitude = 5; // 5 volts
    // generate wave data
    float64 data[1000];
    for( int i=0; i<1000; i++ )
    data[i] = dblAmplitude * sin( (double)i * 2.0 * PI/1000.0 );
    // device, channel and terminal names
    char szDeviceName[128];
    strcpy(szDeviceName,"PXI1Slot3"); // PXI1Slot3
    char szChannel[128];
    sprintf(szChannel,"%s/ao0",szChannelName); // PXI1Slot3/ao0
    char szTerminal[128];
    strcpy(szTerminal,"Onboard Clock"); // Onboard Clock
    // reset device
    long lReturn = DAQmxResetDevice(szDeviceName);
    _AddToLog("DAQmxResetDevice",lReturn);
    // create task
    lReturn = DAQmxCreateTask("",&m_hTask);
    _AddToLog("DAQmxCreateTask",lReturn);
    // if that worked...
    if(lReturn==0)
    // create output voltage channel
    lReturn = DAQmxCreateAOVoltageChan(
    m_hTask,
    szChannel,
    -1 * dblAmplitude,
    dblAmplitude,
    DAQmx_Val_Volts,
    NULL
    _AddToLog("DAQmxCreateAOVoltageChan",lReturn);
    // if that worked...
    if(lReturn==0)
    // define sampling
    lReturn = DAQmxCfgSampClkTiming(
    m_hTask,
    szTerminal,
    10*1000,
    DAQmx_Val_Rising,
    DAQmx_Val_ContSamps,
    1000
    _AddToLog("DAQmxCfgSampClkTiming",lReturn);
    // if that worked...
    if(lReturn==0)
    // write to buffer
    long lWritten = 0;
    lReturn = DAQmxWriteAnalogF64(
    m_hTask,
    1000,
    0,
    10.0,
    DAQmx_Val_GroupByChannel,
    data,
    &lWritten,
    NULL
    CString strLine;
    strLine.Format("Samples per channel written: %d",lWritten);
    _AddToLog(strLine);
    _AddToLog("DAQmxWriteAnalogF64",lReturn);
    // if that worked...
    if(lReturn==0)
    // start task
    lReturn = DAQmxStartTask(m_hTask);
    _AddToLog("DAQmxStartTask",lReturn);
    else
    // clean up
    _CleanUp();
    void _CleanUp( void )
    // stop task
    long lReturn = DAQmxStopTask(m_hTask);
    _AddToLog("DAQmxStopTask",lReturn);
    // clear task
    lReturn = DAQmxClearTask(m_hTask);
    _AddToLog("DAQmxClearTask",lReturn);
    ***** END OF APPLICATION *****

    Broccoli wrote:
    I want to create a simple sine wave output on a PXI-5421 card. I have looked at the sample projects for DAQmx, and based an application on them.
    The application falls over at the call to DAQmxWriteAnalogF64 using the following parameters:
    lReturn = DAQmxWriteAnalogF64(
    m_hTask,
    1000,
    0,
    10.0,
    DAQmx_Val_GroupByChannel,
    data,
    &lWritten,
    NULL
    What am I doing wrong?
    Below is the output of the application, and the code.
    ***** START OF OUTPUT *****
    DAQmxResetDevice -> SUCCESS
    DAQmxCreateTask -> SUCCESS
    DAQmxCreateAOVoltageChan -> SUCCESS
    DAQmxCfgSampClkTiming -> SUCCESS
    Samples per channel written: 0
    Source terminal to be routed could not be found on the device.
    Make sure the terminal name is valid for the specified device. Refer to Measurement & Automation Explorer for valid terminal names.
    Device: PXI1Slot3
    Property: DAQmx_SampClk_Src
    Source Terminal:
    Task Name: _unnamedTask<0>
    Status Code: -200040
    DAQmxWriteAnalogF64 -> -200040
    ***** END OF OUTPUT *****
    ***** START OF APPLICATION *****
    void Startup( void )
    // get amplitude
    double dblAmplitude = 5; // 5 volts
    // generate wave data
    float64 data[1000];
    for( int i=0; i<1000; i++ )
    data[i] = dblAmplitude * sin( (double)i * 2.0 * PI/1000.0 );
    // device, channel and terminal names
    char szDeviceName[128];
    strcpy(szDeviceName,"PXI1Slot3"); // PXI1Slot3
    char szChannel[128];
    sprintf(szChannel,"%s/ao0",szChannelName); // PXI1Slot3/ao0
    char szTerminal[128];
    strcpy(szTerminal,"Onboard Clock"); // Onboard Clock
    // reset device
    long lReturn = DAQmxResetDevice(szDeviceName);
    _AddToLog("DAQmxResetDevice",lReturn);
    // create task
    lReturn = DAQmxCreateTask("",&m_hTask);
    _AddToLog("DAQmxCreateTask",lReturn);
    // if that worked...
    if(lReturn==0)
    // create output voltage channel
    lReturn = DAQmxCreateAOVoltageChan(
    m_hTask,
    szChannel,
    -1 * dblAmplitude,
    dblAmplitude,
    DAQmx_Val_Volts,
    NULL
    _AddToLog("DAQmxCreateAOVoltageChan",lReturn);
    // if that worked...
    if(lReturn==0)
    // define sampling
    lReturn = DAQmxCfgSampClkTiming(
    m_hTask,
    szTerminal,
    10*1000,
    DAQmx_Val_Rising,
    DAQmx_Val_ContSamps,
    1000
    _AddToLog("DAQmxCfgSampClkTiming",lReturn);
    // if that worked...
    if(lReturn==0)
    // write to buffer
    long lWritten = 0;
    lReturn = DAQmxWriteAnalogF64(
    m_hTask,
    1000,
    0,
    10.0,
    DAQmx_Val_GroupByChannel,
    data,
    &lWritten,
    NULL
    CString strLine;
    strLine.Format("Samples per channel written: %d",lWritten);
    _AddToLog(strLine);
    _AddToLog("DAQmxWriteAnalogF64",lReturn);
    // if that worked...
    if(lReturn==0)
    // start task
    lReturn = DAQmxStartTask(m_hTask);
    _AddToLog("DAQmxStartTask",lReturn);
    else
    // clean up
    _CleanUp();
    void _CleanUp( void )
    // stop task
    long lReturn = DAQmxStopTask(m_hTask);
    _AddToLog("DAQmxStopTask",lReturn);
    // clear task
    lReturn = DAQmxClearTask(m_hTask);
    _AddToLog("DAQmxClearTask",lReturn);
    ***** END OF APPLICATION *****
    Hello Broccoli,
    NI-DAQmx is not a supported API for the NI-5421 AWG. For all NI Signal Generators, please use the NI-FGEN API, which shipped with your instrument. You may also download NI-FGEN (2.2.1 as of today) from
    http://digital.ni.com/softlib.nsf/954feaeea92d90918625674b00658b83/8b1f32b4b8f7148586256efd006075a9?OpenDocument
    You should find helpful C examples bundled with NI-FGEN that will make using the NI-5421's full capabilities very easy.
    Marcos Kirsch
    Signal Generators Software Engineer
    Marcos Kirsch
    Principal Software Engineer
    Core Modular Instruments Software
    National Instruments

Maybe you are looking for

  • I have had my macbook pro for 4 months and it is now running extremely slowly

    please can somebody help me, i don't know anything technical about computers. my 15'' macbook pro has overnight started to run extremely slowly, it is now becoming impossible to use my macbook and it is only 4 months old, i have no idea why and the o

  • How can I remove the thin black border of Flash movie when viewed in a browser?

    There is a thin border at the top and left margins of my Flash movie when the .html is viewed in a browser. How can it be removed? Here's the movie. One solution suggests replacing some code, but the code they suggest replacing doesn't even exist in

  • Best java reporting tool

    hi, I'm developing client/server application and need to use reporting tool i have analysed several reporting tools(crystal report,jreport, espress report,jfree report,rreport,inet soft's style report,Formula One e.Report Engine etc.) but coluld n't

  • What program besides Mail.app might use "envelope index"?

    I routinely copy my Mail data between my two computers I use in different cities, copying any changes in Users ▸ [me] ▸ Library ▸ Mail from one to the other via a portable hard drive. This method worked great up through Mt Lion but has hit a snag in

  • Decision boxes do not open fully and often 2 lines of print overlap

    Decision boxes to enter passwords or other info, do not open completely, preventing access to areas requested, with no way to change the size of the box. Lines of print often overlay one another, preventing reading & understanding of data. This has n