C++ PCI-6703 generate analog output

Hello

I'm new on Measurement Studio for VC ++ and I need your help.
I have a PCI-6703 with a box-CBS 68.
I installed the drivers necessary for NOR-DAQmx measurement & motor with Solution Explorer.
I installed the software measurement Studio 2009 (trial pending the validation that my project leader buys the full version).
I work in Visual Studio 2008 and VC ++ (I can't use LabView (if it was not easier) to synchronize the codes for the entire project).

I want to generate analog voltages (10V) at the exit of the PCI-6703 for SCB - 68 box. This will send signals to an eCard to turn lights.
I tried these lines of code, but it does not work (I am inspired by the codes I found on the forum):

#include
#include "windows.h".
#include

int main (int argc, char * argv [])
{
TaskHandle daqmxhandle;

If (InitCVIRTE (0, argv, 0) == 0)
Returns - 1;    / * memory * /.

DAQmxCreateTask ("", & daqmxhandle ");
DAQmxCreateAOVoltageChan (daqmxhandle, "Dev1/ao0", "",-10,0, 10.0,)
DAQmx_Val_Volts, "");
  
for (int i = 0; i)<>
{
DAQmxWriteAnalogScalarF64 (daqmxhandle, 0, 10, 10.0, 1);
Sleep (3000);
      
DAQmxWriteAnalogScalarF64 (daqmxhandle, 10.0, 1, 0, 0);
Sleep (3000);
    
}
    
DAQmxClearTask (daqmxhandle);
return 0;
}

-----------------------------------------------Error----------------------------------------------------------
1 >-rebuild all started: project: test1, Configuration: Debug Win32 -.
1 > deleting intermediate files and output from 'test1' project, configuration ' Debug | Win32'
1 > compilation...
1 > test1.cpp
1 > c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7256): warning C4005: 'THREAD_BASE_PRIORITY_MIN': macro redefinition
1 > c:\program NIUninstaller instruments\measurementstudiovs2008\vcnet\include\cvidef.h(140): see previous definition of 'THREAD_BASE_PRIORITY_MIN '.
1 > c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(7257): warning C4005: 'THREAD_BASE_PRIORITY_IDLE': macro redefinition
1 > c:\program NIUninstaller instruments\measurementstudiovs2008\vcnet\include\cvidef.h(143): see previous definition of 'THREAD_BASE_PRIORITY_IDLE '.
1 > manifest compilation of resources...
1 > version of the compiler Microsoft (R) Windows (R) Resource 6.1.6723.1
1 > copyright (C) Microsoft Corporation.  All rights reserved.
1 > Linking...
1 > test1.obj: error LNK2019: symbol _DAQmxClearTask@4 referenced in function _main outstanding external
1 > test1.obj: error LNK2019: symbol _DAQmxWriteAnalogScalarF64@28 referenced in function _main outstanding external
1 > test1.obj: error LNK2019: symbol _DAQmxCreateAOVoltageChan@36 referenced in function _main outstanding external
1 > test1.obj: error LNK2019: symbol _DAQmxCreateTask@8 referenced in function _main outstanding external
1 > test1.obj: error LNK2019: symbol _InitCVIRTEEx@12 referenced in function _main outstanding external
1 > C:\Documents and Settings\Default\Mes documents\Visual Studio 2008\Projects\test1\Debug\test1.exe: fatal error LNK1120: 5 unresolved external
1 > build log was recorded at the 'file://c:\Documents and Settings\Default\Mes documents\Visual Studio 2008\Projects\test1\test1\Debug\BuildLog.htm ".
1 > test1 - 6 error (s), 2 warning (s)
= Rebuild everything: 0 succeeded, 1 failure, 0 was ignored.

Hi AndriRavo,

I have seen that you had the cvirte library.

You can't use it with Visual Studio. This library and functions such as InitCVIRTE are used when you program with CVI.

Just use DAQmx features but remove all features CVI for example you found.

#include "windows.h".
#include

int main (int argc, char * argv [])
{
TaskHandle daqmxhandle;

DAQmxCreateTask ("", & daqmxhandle ");
DAQmxCreateAOVoltageChan (daqmxhandle, "Dev1/ao0", "",-10,0, 10.0,)
DAQmx_Val_Volts, "");
  
for (int i = 0; i)<>
{
DAQmxWriteAnalogScalarF64 (daqmxhandle, 0, 10, 10.0, 1);
Sleep (3000);
      
DAQmxWriteAnalogScalarF64 (daqmxhandle, 10.0, 1, 0, 0);
Sleep (3000);
    
}
    
DAQmxClearTask (daqmxhandle);
return 0;
}

Kind regards

Tags: NI Software

Similar Questions

  • How to determine the number of highlight ' to write ' for DAQmx generate analog output?

    On the configuration of the stage for DAQmx generate analog output, there is a field "value to write.  I can't find any explanation for what it is, how it determines the value to enter, nor what he writes.  I am trying to go through the tutorials and it cling.

    Someone would give an explanation?

    Hello

    To write value specifies the value to write in the channels, lines or ports selected in string parameters. In other words, this value will be the value of your DC output (for example if you enter 5, your output will be 5V). To get information on different fields in SignalExpress, access help"context-sensitive help. A pane will appear in your work environment that displays the coordinates of the field when you place your pointer over them.

    For new users of SignalExpress:

    Generation of DC signals with NI DAQmx devices: step in the DAQmx build, select 1 sample (on request) in the generation Mode dropdown. You can select a programmatic input to generate, or you can remove the check mark from the check box use programmatic input and specify a value for generating in the field of value to write . NOR-DAQmx help also provides additional information about the data generation.

    Best regards

    M Ali

    Technical sales engineer

    National Instruments

  • PCI 6221 generating an output voltage

    Hi all

    I'm trying to use a card PCI-6221 to provide a voltage of 5V analogue output and use it HAVE read the returned signal using labview. Anyone know how I can do this using this hardware device?

    Thank you

    Hi lrving9,

    First you need the DAQmx driver, here is the link for you to install the latest version.

    NOR-DAQmx 15.0.1
    http://www.NI.com/download/NI-DAQmx-15.0.1/5353/en/

    If you already have it, so go ahead and take a look at this example:

    It shows you how an analog DC output voltage.

    Community: Output analog voltage constant
    https://decibel.NI.com/content/docs/doc-18631

    So you have a block of connection to connect the signals?

    If you do, then you can simply create a task to read a continuous voltage entry, as in this example

    Community: - Input voltage
    https://decibel.NI.com/content/docs/doc-25105

    If you do not have a connection block and have no way to connect the OD to HAVE, then you can read the inner channel of AO, as shown in this link (there is an example at the bottom):

    It is Possible to read the value of the digital or analog output channels?
    http://digital.NI.com/public.nsf/allkb/CB86B3B174763C3E86256FFD007A2511

    Also when you install the driver a few examples are installed as well, this shows you how to get them:

    Where are the examples of NOR-DAQmx installed?
    http://digital.NI.com/public.nsf/allkb/E3BAF6FC4017960B8625755A00525D37

    Kind regards

    Caroline

  • Generating analog output signals 4 with different frequencies

    Hi all

    I was trying to say to generate 4 different signals at different frequencies

    1. first waveform is a sine wave with 5000 Hz,

    2. other with 8000Hz,

    3. third, one is a square with 25 Hz waveform and

    4. fourth one with triangular waveform 50 Hz

    all waveforms must be generated simultanoeusly.

    I tried to generate with the task unique analog output and sample clock (clock rate is 100000). Cross in scope that I see only 5000 and 8000 Hz we generated correctly and the rest two waveforms show the incorrect frequency.

    I guess that's due to the frequency of high clock to sample for more low frequencies for ex 25 Hz and 50 Hz. If I reduce the clock rate to get the lower frequencies properly so I can't generate frequencies higher correctly. (there's a clsh between frequencies and the clock frequency)

    Is it possible to use DAQ board master sample clock and its magnitude downward revision (everywhere where it is necessary for each waveform separately) to generate all the signals at different frequencies at the same time in a single task?


  • Generate analog output with the software "Timing" on 6009

    I see that the 6009 does not support the synchronization of the internal clock.  We need to generate an analogue waveform which changes very slowly, it performs a cycle every 10-20 minutes.

    I saw an old post on the use of calendar software, but can not find a way to do this using SignalExpress.

    Any ideas or references to examples of messages, etc. are greatly appreciated.

    Analog output clocked by the software (DAQmx) in SignalExpress

    I hope this helps.

  • Generate analog output waveform finish on request

    Hello.

    I have a VI that reads in two data channels (400 samples at 400 Hz), calculates the characteristics and classifies data based on a model.  If the class is a certain State, a Boolean value called "Détection" is set to True.  A second Boolean value called "Stimulation" is also set to true and flip flops and turn off every second up to what the "detection" is more true.  Now that I am reading and classify a second data, Boolean values may only be updated once per second.  I am wanting to generate output "Stimulation" Boolean is true analog.  I had been accomplish this by generating a sinusoidal signal all the time and write to a buffer in a separate loop (500 samples per writing @ 10 kHz) and multiplying by zeros if "Stimulation" was false.  I have a code that more or less does what I want, but there is a delay of ~ 200ms between 'Stimulus' is set to True and AO generation, and I feel like it could be simplified.  I was wondering if it would be better to generate a waveform finished and trigger to write with the Boolean value of 'Stimulus' (i.e. write 1 second of a sine wave to the changing state rather than write 20 sections of a sine wave in a second, while the Boolean value is True).

    Y at - it a good way to do this with daqmx functions? (Generate a waveform of defined duration when a control changes)


  • Analog output PCI-6251-DAQ-200016 memory overflow error

    NI PCI - 6251 DAQmx, AIMD-752 motherboard, dual core processor, a lot of speed and the ram running WinXP Pro & LabWindows/CVI

    get DAQ-200016 memory overflow error when I try to generate a signal of analog output with a rate higher than about 32 000 samples/second (?)

    going on what?  I have never seen it before.   Is this a problem with the motherboard?    "It's the same product on the CVI code example" \Cont Gen Volt Wfm - Int Clk\ContGen - IntClk.cws.

    If someone has had this problem, and is there a solution?

    Thank you

    PS: full text of the message reads:

    Measurements: On-board memory precision passing. Due to the limitations of system and/or the bandwidth of the bus, the driver could not write data to the device fast enough to track the rate of output of the device.  Reduce your sampling rate, change the method of transfer of data (from interruptions on DMA), use a product with more on-board memory or reduce the number of programs that your computer runs simultaneously. Task name: _unnamedTask<1> Code of State:-200016

    Well, I found my answer.   For later use, Olivia NI Apps Engineering suggested I have change the mechanism of data transfer by this Knowledge Base document:

    http://digital.NI.com/public.nsf/WebSearch/C326F7D33CA6DB0E86256DFE008043B7?OpenDocument

    ... so I inserted the line of code between the creation of the area of OCCUPANCY of the channels and set up the example of clock calendar.

    DAQmxCreateAOVoltageChan( ...
    
    DAQmxSetAODataXferMech(TaskHandle,chan,DAQmx_Val_Interrupts);
    
    DAQmxCfgSampClkTiming(...
    

    now, I am able to generate output to a 2.35 MS/sec... max sampling frequency not quite the 2.86MS / sec indicated in the specification 6251, but close enough that I'll stop complaining

  • generate a square on the analog output wave

    I use a PXI-6229 DAQ card and I need to generate a square on ao0 wave.  I'm programming in c# and have found an example of the expedition, which generates a sine wave.  I need to be able to modify the function generator that was provided with the example of the expedition to produce a square wave 7.2 kHz with duty cycle of 50% and 2 v peak-to-peak.  I enclose the code generator to function.

    Thank you

    After a lot of trial and error and adapt the example to generate a sinusoidal signal, I have the solution to generate a square signal of analog output.  I enclose the code.

  • Strange problem with analog output PCI 6251 and BNC-2110

    I'm controlling current source of third parties using the connectors of analog output on my card PCI 6251 and BNC-2110.

    The current source needs an input signal of 0.1V. I tested it using a battery, the potentiometer and the voltmeter, and by manually adjusting the voltage of power current works - current output with control voltage scales according to the specifications and is relatively stable.

    The data acquisition card works too - when I connect a voltmeter to the AO0 AO1, the measured voltage corresponds to the target with great precision value.

    But when I connect the current source of third AO0 AO1 data acquisition card, the measured output voltage drops and fluctuates. This applies to both channels of the AO.

    I wonder what is the problem here. I suspect it could be a matter of the grounding - the current analog control of the source is an entry with two floating terminals differential. I tried to return the switches FS/GS on the BNC-2110, but that makes no difference.

    Anyone knows similar behavior? Does anyone have any suggestions?


  • Problem of generation of the analog output on PCI-7342

    I use for the control of servo motor with encoder Axis 1 of my PCI-7342 feedback

    and trying to out of the velocity of the encoder on the analog output of the axis-2 which is currently not used.

    For testing purposes, I pulled out a constant 16383 (half of 32767) to the analog output

    through load DAC.flx permanently, but there is no voltage on the map of the motion.

    I read

    http://digital.NI.com/public.nsf/WebSearch/102BE3EEED8A8B0DC1256EDA0059EC47?OpenDocument

    http://forums.NI.com/T5/motion-control-and-motor-drives/analog-output-voltage-from-UMI-7764/m-p/5219...

    http://forums.NI.com/T5/motion-control-and-motor-drives/configuring-the-analog-output-of-PCI-7358-mo...

    and configure my 2 axis to be a stepper motor. I also tried to disable axis - 2. None of them works for me.

    Also, I tried to read the value of CAD using reading DAC.flx right after that load DAC.flx is called.

    Correctly, the value was shown on the screen. (See the attached figure)

    I'm really bad now. Please, please, please help!

    Any possible solution is fully appreciated!

    Ron Liou


  • Is a PCI-6120 card in a computer with linux useful for the analog output?

    We have a PCI-6120, and we want to use in a computer with linux OS, to the analog inputs and analog outputs.  I have downloaded the driver NOR-DAQmx Base 3.2 for linux, and in the file README.txt only analog input is mentioned for this Council. It is possible to use this card PCI-6120 in linux, with output and analog input computer?

    Best regards

    Hey, Gallas,.

    This line in the README file simply refers to the PCI-6120 by its more popular, analog input subsystem (given that it is a simultaneous sampling device, the AI is the most commonly used subsystem). But NEITHER-DAQmx for Linux does not have the same limitations NOR-DAQmx base has. In other words, it supports the ability of analog output on the PCI-6120.

    Kind regards

    Sam

  • LabVIEW 7.1 Analog Output is incorrect, computer crashes and often generating output resignations

    Try to put in place an old pc with Labview 7.1 NT with an AT-MIO-16 x card... everything is loaded, I can load OR-DAQ 6.1 examples and Configuration DAQ ESPECIALLY utility works correctly.

    In the config utility, I can put all the settings are correct, but I get the dreaded "the device does not respond to the first IRQ setting" for all the IRQ numbers acceptable that I choose 7,9,10,11 as 5, or 15. Others are simply not available, and all those who are to generate the same message.  However I can run the test panels and get an analog output, for example, fine, tested with an LED.

    So I moved upward to load an example VI, the function generator... Sort of works, it breaks easily, or stops, generating a total, if I hit the stop button and restart, and its output looks nothing like one of the square, etc. in sawtooth, sinusoid, shapes, watching on a scope, it is just hard hitting high then low, sometimes spitting a gust of sinusoid for half a second or so.

    I suspect this is related to the issuance of the IRQ, I searched all knowledge bases, come up with nothing that solves this problem.  Thought maybe someone could lend an idea.  LabVIEW is really more stable than this right?

    Well I've tried a bunch of things and success. Looks like my MIO Board is kaputt.  Good thing I have 3 of the guys. The other set up fine in config and short decent for the torque screw daq example I tried.

    Continuation and thank you very much for answering.

  • What are the PCI ANALOG OUTPUT PORTS Terminal 6024E block CB-68LP

    Dear all

    I want to get the analog output on the physical output signal. In my LabVIEW diagram, I develop the DAQ assistant and configure ao0 as analog output. The tension I want hovel is analog - 5v to + 5 volts. Terminal block, what will be the output port analog physical that I measure this voltage.

    Waiting for ypur response.

    Kind regards

    Irfan

    In MAX, you can simply right-click on the device and select 'device pinouts. The DAQ Assistant will also show pinout.

  • DAQ product with +/-analog output 12V?

    We are looking to update a manual test area.

    We are looking for a product DAQ with analog outputs capable of +/-12V

    We are not generating waveforms. Just using LabVIEW to a tension he set in the range of - 12V and + 12V.

    OR anything with this ability he selling?

    I found the NI PCI-6703 and would serve our needs except that it is +/-10V.

    Good morning New York,

    Consider the SMU-4322 or NI 9269. The SMU-4322 supports + / 16V by channel. The NI 9269 has 4 (+/-10V) channels that can be cascaded for isolated older tensions.

    Kind regards

    Izzy O.

    Product Support Engineer

    NI.com/support

  • variable phase shift between two analog output signals

    Hey! I would drive two different piezo elements with an sine - / square signals and have a phase shifted output signals. After some trail and error, I was able to get a second analog output on my card PCI-6221 (using LabView 8.2) also allowed me to have different amplitudes for both signals. However, I could not output signal having a frequency different and most importantly to my request to have one of the signals variably shifted phase.

    Thanks for the very useful suggestion. I have attached the file .vi installation I've run so far.

    Hello!

    A way to generate waveforms is using the analog waveform Toolbox. I created an example VI that is attached and that shows you a way to use the base generating function VI. I saved for LabVIEW 8.2.

    I hope this helps!

Maybe you are looking for