05-24-2007 01:16 PM
06-12-2007 02:48 PM
hi, i using ni daq for voltage generation. I used an example for ANSI C and changed some things but in general is the same
int32 res;
int n;
CString cadena;
int32 indice;
float64 data[2500], f;
f = m_frec * 1000.0;
n = 250000/f ;
///Genera la señal de salida/////////////////////////////////////
for(indice=0; indice<2500; indice++)
{
data[indice] = Amplitud*sin((double)indice*2.0*PI/n);
}
res=DAQmxCreateTask("",&Genera);
//cadena.Format("%d", res);
//AfxMessageBox(cadena,MB_OK, 0);
DAQmxCreateAOVoltageChan(Genera,"Dev3/ao0","",-10.0,10.0,DAQmx_Val_Volts,NULL);
//cadena.Format("%d", res);
//AfxMessageBox(cadena, MB_OK, 0);
DAQmxCfgSampClkTiming(Genera,"",250000,DAQmx_Val_Rising,DAQmx_Val_ContSamps,2500);
//cadena.Format("%d", res);
//AfxMessageBox(cadena, MB_OK, 0);
DAQmxWriteAnalogF64(Genera,2500,0,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL);
//cadena.Format("%d", res);
//AfxMessageBox(cadena, MB_OK, 0);
res=DAQmxStartTask(Genera);
if (res!=0)
{
DAQmxStopTask(Genera);
DAQmxClearTask(Genera);
}
cadena.Format("%d", res);
AfxMessageBox(cadena, MB_OK, 0);
the message box gave me an idea of the process now i want to eliminate them, but if i put off all the message the program don't work, then how can i put off the message ?
06-13-2007 03:49 PM
Hi alberick,
What do you mean that your program is not working? Are you receiving an error when you run this program? Are you able to generate an analog voltage?
There is still one Message Box that is not commented out. Is this the message box that is showing up? Is this why the program is not working correctly?
07-10-2007 04:16 AM - edited 07-10-2007 04:16 AM
Message Edited by kaimietiz on 07-10-2007 04:17 AM
07-11-2007 11:55 AM
Hello Kaimietiz,
It is recommended to set your data acquisition into three steps. The first step will be creating and configuring the task. The second step will be reading the data from the NI-6251. The last step will be stopping and clearing the task. You would only want to create and configure as well as stopping the task once. When you actually read or acquire the data, you would want this section of your code inside a loop. The first and last steps should be outside the loop and should only be executed once.
In order to read from two channels at the same time, you would want to set your device name like this: “Dev1/a1:a2”. Your data will be put into a 1-D array that is either interleaved or not. The “fillmode” parameter in the DAQmxReadAnaloF64 function will determine if the data is interleaved.
If the data is interleaved then the data will look like the following.
A1 Sample 0
A2 Sample 0
A1 Sample 1
A2 Sample 1
A1 Sample 2
A2 Sample 2
If the data is not interleaved then the data will look like the following.
A1 Sample 0
A1 Sample 1
A1 Sample 2
A2 Sample 0
A2 Sample 1
A2 Sample 2
07-13-2007 01:19 AM
07-17-2007 09:59 AM
07-18-2007 08:04 AM
Hi Stebio,
It sounds like you do not have DAQmx installed on the deployment computer. You can download DAQmx 8.5 here. When developing an application, all drivers and run-time engines used on the development machine also need to be installed on the deployment machine.Also, I would like to ask that new threads be started for any new questions. This not only keeps issues separate, but helps when searching the forums for answers.
08-15-2007 03:38 AM
Hi everyone,
I'm using NI PCI-6221. First I installed the NI-DAQmx 8.5 and then I turned off the PC and plug in the NI 6221 to the PCI slot. Then when I re-boot the PC detected the new hardware (the NI 6221).
Unfortunately, when I run the Measurement and Automation program (version 4.2), I could not found "NI-DAQmx Device" under "Devices and Interfaces". The NI 6221 appears under "PXI System" instead. When I run LabView Signal Express, the program doesn't detect any DAQ device.
I'm using Windows 2000 Profesional.
Thanks
08-15-2007
04:20 PM
- last edited on
07-15-2025
12:19 PM
by
Content Cleaner
Hi nasrul,
Thank you for posting on the National Instruments forums.
If you go into Device Manager in Windows, do you see the card show up as a Data Acquisition Devices? To get to the Device Manager, press Start and Pause on your keyboard or right click on My Computer and click on Properties. In the Hardware tab, click on Device Manager. One thing you might try is to right click on the device in Device Manager and click on Update Driver... and follow the steps.
If you see the device in Device Manager then it should show up in MAX.
As a last resort, I have seen this issue fixed by removing the MAX database. Are there any other cards that are not showing up?
Follow the steps in this knowledge base article: Why Do I Get a Measurement & Automation Explorer (MAX) Database Connection Error?
This is not the error that you are seeing, but I have seen renaming the data folder fix the issue before. Make sure and just rename the data folder, not delete it, so that you can revert to it if needed.
Message Edited by Nick F on 08-15-2007 04:32 PM