How do I get the analog input signal and send it to output analog (real time)

Hello world

I do a simple task in Visual C++ and I use PCI-6221(37 pin).

Basically, I want to send the same signal of "analog input" to the "analog output".

at the same time (or almost), to make real-time application.

Can someone provide me with sample program please.

I would be grateful if you could provide me with the great tutorial that explains

step by step everything about NOR-DAQmx for C/C++ programming.

Best regards

Khassan

This is my code in C++, you can optimize it if that seems too messy. This code reads the analog input signals and exports it through the analog outputs.

To make this code additional work of the directories include and library directories must be added to OR.

I hope it helps someone.

#include
#include
#include "NIDAQmx.h".
#include

#define DAQmxErrChk (functionCall) {if (DAQmxFailed (error = (functionCall))) {goto error ;}}

int main (int argc, char * argv [])
{
Int32 error = 0;
TaskHandle taskHandleRead = 0, taskHandleWrite = 0;
Read Int32 = 0;
float64 context [1000];
char errBuffRead [2048] = {'\0'};
char errBuffWrite [2048] = {'\0'};
bool32 done = 0;
Int32 wrote;

DAQmxErrChk (DAQmxCreateTask("",&taskHandleRead));
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandleRead,"Dev1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleRead,"",100.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,0));
DAQmxErrChk (DAQmxCreateTask("",&taskHandleWrite));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandleWrite,"Dev1/ao0","",-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleWrite,"ai/SampleClock",100.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));

DAQmxErrChk (DAQmxStartTask (taskHandleRead));
DAQmxErrChk (DAQmxStartTask (taskHandleWrite));

While (! fact &! _kbhit())

{

DAQmxErrChk (DAQmxReadAnalogF64(taskHandleRead,1,10,DAQmx_Val_GroupByScanNumber,dataRead,1000,&read,));

DAQmxErrChk (DAQmxWriteAnalogF64(taskHandleWrite,read,0,10.0,DAQmx_Val_GroupByChannel,dataRead,&written,));

}
_getch();

Error:
If (DAQmxFailed (error))

{
DAQmxGetExtendedErrorInfo (errBuffRead, 2048);
DAQmxGetExtendedErrorInfo (errBuffWrite, 2048);
}
If (taskHandleRead! = 0)

{

DAQmxStopTask (taskHandleRead);
DAQmxClearTask (taskHandleRead);
}
If (taskHandleWrite! = 0)

{

DAQmxStopTask (taskHandleWrite);
DAQmxClearTask (taskHandleWrite);
}
If {(DAQmxFailed (error))
printf ("error DAQmx: %s\n",errBuffRead); ")
printf ("error DAQmx: %s\n",errBuffWrite); ")
}
printf ("end of the program, press the Enter key to quit\n");
GetChar ();
return 0;
}

Tags: NI Hardware

Similar Questions

  • I get an error message 205, how do I get the file to download and recognize as legitimate?

    I get an error message 205, how do I get the file to download and recognize as legitimate?

    Help creating cloud / cloud creative applications download error

    http://helpx.Adobe.com/creative-cloud/KB/error-downloading-CC-apps.html

  • How can I get the forum of Catalyst to send me an email I can approve or delete the post quickly?

    How can I get the forum of Catalyst to send me an email I can approve or delete the post quickly? I want to know when someone is posting in the forum not to make people wait until I have run my laptop and visit the catalyst for postings.

    Hi, here is an article on the moderation of messages that you will find useful:Managing forum messages

    Hope this helps,

    Mihai

  • the computer keeps going into hibernation... How can I get the monitor turns on and stop reading "monitor is asleep."

    The monitor lights. It reads monitor is asleep. Sometimes if I'm patient enough for the computer to turn on and off the screen lights up and indicates that the computer has been hard to get out of hibernation. How can I disable hibernation?

    Hello melissacrowley,

    1. you have the latest drivers installed for the graphics card on your computer?

    I suggest that you update the drivers for the graphics card and check if you have the same problem. You can check the below article which will give you information on how to update the drivers:

    http://Windows.Microsoft.com/en-us/Windows7/update-a-driver-for-hardware-that-isn ' t-work correctly

    Thank you
    Irfan H, Engineer Support Microsoft Answers.

  • I chose a character, but when I start Firefox, Mozilla start page with Google, and persona shows is only barely visible in the toolbar area. How can I get the persona of show and not Google start page?

    I checked the Personas of Mozilla, has seen one I liked and added the. When I start Firefox, the Mozilla start page shows as usual with Google on this subject. The character I chose shows barely and only in the area of the toolbars at the top of the screen. Can I change the start page to not display Google and access Google another average, so that my character is displayed on the start page of together?

    This has happened

    Each time Firefox opened

    == I added on Persona

    As you can see on the article using themes with Firefox , personas are 'lightweight themes that can change the color plan and the Firefox toolbar background image' and they do not change Web pages.
    If you do not see Google as home page you can watch How to set the home page and change it.
    Finally Firefox 3.5.x will be maintained with security and stability updates until August 2010, so you may want to update to a newer version.

  • How can I get the relief of lights and shadows of otherwise transparent type?

    I want to type in a form that cleared the underlying image side highlight of embossing and dark on the side of the shadow, but leaves the body of the transparent type embossed. How would I do that? I apply a certain amount of transparency of a layer of text, then the type is not totally obcure the underlying image.

    I usually apply a fairly transparent version of a copyright image in Lightroom, to keep discreet but always readable, if you really look for it. See the bottom left of the pictures to https://www.facebook.com/drew.tronvig/media_set?set=a.10151421311963431.507404.596468430 & t ype = 3. I created this image of copyright in GIMP or something, but I need to generate even more, and I really want to stay in Photoshop.

    Use the Layer Styles and set the fill of the layer (in the layers panel) to 0.

    -Christmas

  • I installed Windows 7. How can I get the programs WORD, EXCEL and POWERPOINT?

    I bought and installed WINDOWS 7. I can't find WORD, EXCEL and POWERPOINT. What should I do to use these programs?

    I bought and installed WINDOWS 7. I can't find WORD, EXCEL and POWERPOINT. What should I do to use these programs?

    If you do not have the original media, you must buy it. Any version of Windows ever don't come with office or one of its programs for free.

  • How can I get the characters setting out and lower text to display in the bookmarks?

    All instances appear as regular text.

    The bookmark names do not support the formatting of characters. The ISO standard allows that a global model - one color and the bold or italic style for the name - nothing else is allowed.

  • How can I read the active (connected) Renault and send then to the entry on DAQ device name help?

    I have a property system for daqmx node but it won't let me change it to read when I right click on it. I try to have my program detect the name of data acquisition which is plugged into the PC and then send to the daq assistant so that it runs properly wiithout having me manually change the name of the device every time I change hardware.

    labview12110 wrote:
    Im just frustrated that the only function I have is to get a list of the things that I can't do anything with. MAX knows who is active can I call in some way?

    You do the programming.  What is LabVIEW.  MAX gives you all the tools to do what you want and much more just to do what you want to program.

    Joined a VI that does what you want.  I look at all your devices and returns the first not simulated.  Apparently this list already excludes devices not connected to the system.

  • How to get the user input to dynamic Action confirmation message?

    Hi guys,.

    I use apex 4.1.

    I added a page dynamic Action confirmation message box. How can I get the user input to the confirmation pop up?

    Thank you

    Hello

    you do not directly get user input. But you should still be able to get what you want. Suppose you have a dynamic action which fires for a 'change' (or other) and who has two or more actions

    (1) confirm
    (2) execute the PL/SQL Code

    If the user clicks Cancel/no in the confirm dialog box, APEX stops execution of this dynamic action and not run "run the Code in PL/SQL.

    Hope that helps
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • How can I get the data view to display the same amount of time I save?

    I use the Sound and Vibration Measurement Suite.  In the data view, I display a graph of time, the power spectrum, the Color Map and the waterfall.  I am also showing strength in numbers group for several bands and doing cutting-edge research.  I record 100 ms of the transient wave.  In the data view, why the temporal plots show several seconds of data?  What determines how much time will appear in the data view?  More important, the power spectrum reflects the power for the entire of several seconds of data displayed?  Same question for power in the values of band and cutting-edge research.  I want to just this data displayed for 100 ms of the wave that I record.  So, how can I get the data displayed (waveforms) and power numbers come only 100 ms of the recorded wave?

    Finally, what is the best way to make account concisely the recorded data?  By slide numbers on the Documentation tab is not concise, because it comes with graphics, etc..  I tried save as ASCII/LVM, but I get a bunch of stuff intermiated I don't care.  Help?

    Hi TimRsandiego,

    SignalExpress is programmed to display graphs with default scales based on the type of action, it's reading. These scales and settings can be changed by right-clicking on the graph, and then select Properties.

    If you are interested to learn more about how to use SignalExpress, I would recommend checking out some demonstrations/tutorials on NI.com. You can find some of these demos at the following location:

    Let me know if you have any other questions.

    Kind regards

  • How can I get the age of Mythology to work on Windows Vista, every time I put the disc in the computer installation screen dosnt pop up and nothing happens

    Moose title: How can I get the age of Mythology to work on windows vista

    every time I put the disc in the computer installation screen dosnt pop up and nothing happens the disc passes just for a bit and stops, and the cursor hangs a bit and I can't get the disk to the computer unless I restart the computer

    Hi rew55545,

    (1) is this problem limited only to the age of Mythology disc?

    (2) what version of the game you are trying to install?

    Method 1: Run the fixit available in the link below and check if that makes a difference

    Your CD or DVD drive cannot read or write media

    http://support.Microsoft.com/mats/cd_dvd_drive_problems/en-us


    Method 2:
    run the fixit available in the link below to resolve any problems with DVD player.

    Hardware devices do not work or are not detected in Windows

    http://support.Microsoft.com/mats/hardware_device_problems/en-us

    Method 3:  Select the boot and then check if the problem persists

    Follow step 1 in the link below,
    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    Important: n ' forget not to put the computer to a normal startup follow step 7 in the link.

  • How can I get the USB-Quad08 with Dasylab encoder channel data

    Hello

    I'm reading the pulse signal of USB-Quad08 with Dasylab V10, but every time I got the error message "this Committee has no meter 9513.

    I have configured the jury with Instacal and the test hardware is ok. I used the module 'Entry meter' (Modules--> inputs / outputs--> MCC - DAQ--> Counter Input) to read the signal of the channel meter. "Entry 9513 counter" displayed and I na not change settings. After connecting a graphic recorder module I run the application. The error message appeared.

    I noticed that USB-Quad08 Council has counter 9513. But why the error occurs?  How can I get his channel encoder signal?

    PS. I can get with Dasylab DIO signals, but I can't any signal with TracerDAQ, even I can't find USB-Quad08 in his list of DAQ devices.

    Please contact Measurement Computing.

  • How can I get the numbers to treat my numeric value in text form?

    When using the 'numbers', I want to type in a number and have it show exactly as input, in this case with leading zeros.  How can I get the program to deal with any symbol in the form of text and enter it exactly as I typed?

    Then select all the cells in the Inspector (right bar), click cell (Format-click just above the Inspector, if the cell is not a choice at the top of the Inspector) and change the Format of text data.

    If the Inspector is not visible in the right sidebar, view menu > Inspector > Format.

  • How can I get the digital power meter?

    How can I get the digital power meter?

    I use a method similar to the example below to measure the market factor using the inputs of a multifunction data acquisition meter.  If the duty cycle is 0% or 100% for a given period, DAQ reading times out and returns an error.  In this case, I would get the digital state of the counter of entry so I can put as cycle to 0% or 100%.  I want to do it without knowing the digital port and line the entrance of counter... for example I would like to continue referencing DAQ/ctrX since I already have this information.

    The application uses an M series: PXI-6229 DAQ and LabVIEW 2011 to make a system customized for VeriStand.

    https://decibel.NI.com/content/docs/doc-12396

    For the moment I wired the block diagram to add a case structure to check the meter ID and string constants to set the identifier of digital input, as they share the physical connection.  As much as I can say that makes the specific code for the PXI-6229 (or any DAQ with only two counters that share connections with p2.1 and p) 1.4

    I have attached the VI sub.

    When the device is used with a different data acquisition, I can add the connection and/or separate control.  Looks like at least one will be necessary given that the meter can only detect the edges... I think it was the piece of information I needed.

    Thanks for your help!

Maybe you are looking for

  • HP Envy 4500: HP Envy 4500 reset admin password

    I just bought a new HP Envy 4500 and impossible to access many functions through the online web interface IP address. It keeps to a secure https version and then pops up to ask for a name and a password. I tried using admin / admin and a lot of varia

  • How can I stop the boot record guaranteed Tempro message?

    Whenever I start my Toshiba Satellite computer, a dialog box with the message "reminder to register Toshiba Notebook has stopped working, Windows is checking for a solution" is displayed. No solution never appears. I looked at the status of the guara

  • Satellite L50D: no video noise after installing MS Essentials 2012

    My new laptop has ever its registered for SKYPE video messaging.Little is boring, like Skype video calls and other similar applications, no problem with microphones/noise etc. Since download Windows Essential 2012, I have no sound for videos which wo

  • Auto boot PXI DMM

    I use NI PXI DMM 4065/4071/4072 with MXI controller to measure the current continuous on my device. I am very sure that PXI DMM are not initialized because the device could not be activated at PC startup unless I opened the DMM front panel and cofigu

  • Mouse Touchpad no longer works correctly

    My touchpad mouse no longer works correctly.  I'm unable to double-click, even after changing the speed setting in the control panel.  In addition, items are selected when appropriate without a click. This could be a virus or a definition that has be