LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating a output signal

Hello,

 

I know this is a litte bit of a easy question. I am new with LabWindows and now I am at the part where I would like to generate a square wave signal. At the moment I can measure a DC signal at the output. I can als change the value but I am not able to measure my square wave signal.

I would like to ask if someone can send me an example code where I can see how a signal is produced and how I can generate it at the analog output from my analog-digital-card (SCB 68B).

 

    double SignalArray[512];
    TaskHandle taskHandle;
    float64 data;           

    double phase=0.0;

 

            SquareWave (512, 2.0, 7.8125e-3, &phase, 50.0, SignalArray);
            PlotWaveform (Haupt, Haupt_GRAPH, SignalArray, 512, VAL_DOUBLE, 1.0, 0.0, 0.0, 1.0, VAL_THIN_LINE,
                                  VAL_EMPTY_SQUARE, VAL_SOLID, 1, VAL_RED);
            
            DAQmxCreateTask ("", &taskHandle);
            DAQmxCreateAOVoltageChan (taskHandle, "Dev1/ao0", "a0Channel", -10.0, 10.0, DAQmx_Val_Volts, "");
            DAQmxWriteAnalogF64 (taskHandle, 1, 1, 10.0, DAQmx_Val_GroupByChannel, &data, NULL, 0);
      
The problem is, in the interface I got the square signal but I do not know how I can get the data from the signal in my analog output. I know that the variable &data ist the key but I do not know how I can my square wave data in there. I think die data should be in "SignalArray".

It can also be that there is a easier way. I would like to know the basic behind this topic with a example code. I read a lot of liturature but I didn't find the anser to generate a signal (not a normal DC voltage) at the output.

 

I hope someone can help me.

 

Best Regards

 

0 Kudos
Message 1 of 3
(3,750 Views)

I suggest you to look at the examples installed with DAQmx: the closest to your scenario is ContGen-IntClk.cws then you can locate with the example finder (Help >> Search examples...) by browsing to Hardware input and output >> DAQmx >> Analog Generation >> Voltage. The example will show you how to prepare and write to the daq board the buffer and configure the board to generate the wave continuously.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(3,745 Views)

Hello,

 

thank you very much. I will look at the example. 

 

Best Regards

0 Kudos
Message 3 of 3
(3,725 Views)