Quantcast
Channel: Measurement Studio for VC++ topics
Viewing all 654 articles
Browse latest View live

How To Read Data From PCI6025E?

$
0
0

Hi everyone,

I need just to know: ''how can i read the data from PCI6025E with my C++ code"?

What should i do for the use my signals(from pci6025E) in C++?

 

Thanks a lot! 


C# wrapper for NI-TCLK

$
0
0

I want to use HSDIO with C# with multiple PXIe cards synchronized with TCLK. I have a wrapper for the HSDIO C DLL so that I can use it with Visual Studio. I can't find a C# wrapper for NI-TCLK. I think in LabWindows there is a niTClk.h header and an associated DLL. It was very easy to find the HSDIO C# wrapper, not sure why it is so tough to find the same wrapper for NI-TCLK. Maybe this functionality is included in other drivers instead of a standalone driver??

Configure Slave Triggering

$
0
0

Hi everyone,

 

I'd like to configure two NI PXI-4204 devices (one as master and one as slave) so that these two devices measure a bunch of samples.

Therefore I've exported the start trigger signal from the master device and set an trigger on this signal for the slave device.

Actually both devices are connected to a frequency generator.

When I'm looking at the measured values I got two data arrays that are NOT synchron.

 

  TaskHandle  thMaster = NULL;
  TaskHandle  thSlave  = NULL;
  double      masterData[SamplesPerChannel*ChannelMax];
  double      slaveData[SamplesPerChannel];
  long        readMasterData = 0;
  long        readSlaveData = 0;
  long        err  = 0;
if(!err) err = DAQmxCreateTask ( "Master", &thMaster ); if(!err) err = DAQmxCreateAIVoltageChan ( thMaster, "PXI1Slot7/ai0", "", DAQmx_Val_Cfg_Default, 0, 20, DAQmx_Val_Volts, NULL ); if(!err) err = DAQmxCfgSampClkTiming ( thMaster, "", SampleRate, DAQmx_Val_Rising, DAQmx_Val_ContSamps, SamplesPerChannel ); if(!err) err = DAQmxExportSignal ( thMaster, DAQmx_Val_StartTrigger, "PXI_Trig0"); if(!err) err = DAQmxTaskControl ( thMaster, DAQmx_Val_Task_Verify ); if(!err) err = DAQmxCreateTask ( "Slave", &thSlave ); if(!err) err = DAQmxCreateAIVoltageChan ( thSlave , "PXI1Slot8/ai0", "", DAQmx_Val_Cfg_Default, 0, 20, DAQmx_Val_Volts, NULL ); if(!err) err = DAQmxCfgSampClkTiming ( thSlave , "", SampleRate, DAQmx_Val_Rising, DAQmx_Val_ContSamps, SamplesPerChannel ); if(!err) err = DAQmxCfgDigEdgeStartTrig ( thSlave , "/PXI1Slot7/PXI_Trig0", DAQmx_Val_Rising);
if(!err) err = DAQmxTaskControl ( thSlave, DAQmx_Val_Task_Verify ); if(!err) err = DAQmxStartTask ( thSlave ); if(!err) err = DAQmxStartTask ( thMaster ); if(!err) err = DAQmxReadAnalogF64 ( thMaster, SamplesPerChannel, 3.0, DAQmx_Val_GroupByChannel, &masterData[0], sizeof(masterData), &readMasterData, NULL ); if(!err) err = DAQmxReadAnalogF64 ( thSlave , SamplesPerChannel, 3.0, DAQmx_Val_GroupByChannel, &slaveData[0], sizeof(slaveData), &readSlaveData, NULL );

Can anyone point out my mistake within the posted code?

 

Thanks,

Matthias

NI SCXI 1000DC software & get started

$
0
0

Hi all,

 

I'm newbie at NI equipments & i'm a researcher in trouble to get started how to use this equipments.We have a SCXI 1000DC with this modules:

NI SCXI 1520 -> to measure strain gages

NI SCXI 1540 -> to measure displacement with LVDTs

NI SCXI 1430 -> to accelerometers

 

I need to use the 3 modules at the same time for mesurements. So, the first question that I have is if NI has some Plug & Play software to use this equipment like signal express (I now that signal express could be used with compactDAQ but i tried to plug the SCXI and nothing happens).

 

The second question that i have is: I have been searching for information about how to develop your own aquisition software for this equipment, one solution that I found is to use VC++, but i don't have much information about how to get the libraries and their explanation and tutorials. 

 

And the last question: If you develop some VC++ software there is no need to install any drivers in computer to make the data acquisition, right?

 

I'm not an expert at VC++ but i think i can handle.

 

Sorry if my questions are very newbie...

Best regards all

 

 

Linking errors when using ibsta

$
0
0

Hello,

 

I have been trying to write C code to automate a Keithley 2410 through GPIB.  I am using Windows XP 32-bit, and VC++.

 

I believe I was successful in getting a handle to the gpib-32.dll. However, I am getting a linking error when I try to use ibsta:  1>helloworld.obj : error LNK2001: unresolved external symbol _ibsta
1>C:\Documents and Settings\Prober\My Documents\C Programs\helloworld\Debug\helloworld.exe : fatal error LNK1120: 1 unresolved externals

 

However, when I look through the ni488.h, I see that ibsta is a global variable.  Therefore I am confused as to why I am getting a linking error

 

I am following this guide: http://na.tm.agilent.com/pna/help/latest/Programming/GPIB_Example_Programs/GPIB_using_Visual_C++.htm

 

My code is attached :)

 

 

wpf graph

$
0
0

Bonjour,

 

Je vous expose mon  probleme.

 

J'ai developpe une application  sous Win7 et VS2010 environnement C# et wpf.

 

Je dois afficher une courbe en temps réel sur une periode d'une heure avec un nouveau point toutes les 100ms (soit max 36000).

 

J'utilise l'objet graph NI et je dois également afficher le temps sur l'axe des abcisses. les graph sont "databinder" 

 

1er methode : J'ai utilser un analogWaveform mais au bout de 20000 points le rafraichissement commence a ralentir.  

 

2eme methode : J'ai vu sur le site la page optimisation des graph donc je passe par un objet ChartCollectionAnalogWaveform. Je le dimensionne a 36000 et effectue un append toutes les 100ms 

 

//ChartcollectionAnalogWaveform[] LengthCurveChart ;

//toutes les 100 ms
      NationalInstruments.AnalogWaveform<double> __waveLength = new AnalogWaveform<double>(1);
      DateTime[] __time =new DateTime[1];

      __waveLength.Timing = WaveformTiming.CreateWithRegularInterval(new TimeSpan(0, 0, 0, 0, 100), new DateTime(2000, 1, 1, 0, 0, 0));

              
      LengthCurveChart[0].Append(__waveLength);

 

Mais sur cette derniere methode j'ai un plantage au bout de quelques minutes ("Tha data store was modified ... Buffer<DateTime>".

 

Je n'ai pas trouver d'exemple sur le net avec des chartCollectionAnalogWaveform et/ou des affichage avec l'horodatage en abcisses.

 

J'aimerais savoir comment faire quel objet ou quellle methode utiliser ?

 

Merci

 

Johan

Multichannels Synchronized AI AO start trigger shared external clock

$
0
0

I am developed a program after the sample program Sync AI AO.  I use encoder  Z index as start trigger and A signal as external clock to generate and acquired samples at the same time using DAC PCI 6733 and ADC PCI 6143.   I generate continuous signal and change it constantly. The Generation and Acquisition are synchronized for one channel. The problem arise when I use two channels. The PCI 6733 change the output but the PCI 6143 needs more cycles to take the updated output signal. I can upload the c code when is necessary.

offset problem : DAQmxPerformBridgeOffsetNullingCalEx

$
0
0

Hello All,

 

I have an problem of OFFSET .

 

I explain:

I use 2 NI cDAQ-9178

 

Test 1:

A module 9213 is plugged on 1 NI cDAQ-9178

A module 9237 is plugged on 1 NI cDAQ-9178

If I call the function : DAQmxPerformBridgeOffsetNullingCalEx  for the module 9237, there is no problem this function returns 0.

 

Test 2:

The two modules 9213 and 9237 are plugged on the same NI cDAQ-9178.

If I call the function : DAQmxPerformBridgeOffsetNullingCalEx  for the module 9237, the function returns -200478

 

Why........

I dont understand why I get this error.

 

Thanks for your responses.


Cont Gen Volt Wfm-Ext Clk-Dig Start Example

$
0
0

I use Cont Gen Volt Wfm-Ext Clk-Dig Start project in VS 2013 pro, to test, but the output on my meter is 0 volt. my question is simple: What I need to do to to make this example work? I use aoO as in example. No errors. When I use Ni MAX - > Test Panels -> Analog Output -> Change output value - it is working, but not with this example..

 

Thank you

need i for this continuous reading a callback function

$
0
0

Hello

 

i write a little programm. with this programm i like to read continuous samples from my NI 6251 with 1MHZ. I works okay, but every 3000 samples it is not continuous and i lost 0,010ms. I think think i not good to initialised the task every 3000 samples, but i have found no other solution that is working for me.

 

Need i a callback funtion to do this or need i on external clock to do this correct..

 

Here is mylittle porgramm.

 

#include<stdio.h>

#include<NIDAQmx.h>

#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else

int main(void)

{

int32 error=0;

TaskHandle taskHandle=0;

int32 read;

float64 data[3000];

char errBuff[4096]={'\0'};

float64 spannung1[3000];

int32 start = 0;

 

int i;

 DAQmxErrChk (DAQmxCreateTask("",&taskHandle));

 DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0","",DAQmx_Val_Diff,-10.0,10.0,DAQmx_Val_Volts,NULL));

 DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",1000000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,3000)); 

 

for (start=0;start<1000;start++)

{

DAQmxErrChk (DAQmxStartTask(taskHandle));

 

 DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,3000,10.0,DAQmx_Val_GroupByChannel,data,3000,&read,NULL));

for(i=0; i<3000; i++) {

 

spannung1[i]=data[i];

 printf("Zahl %d %d %f\n",start,i, spannung1[i]);

}

DAQmxStopTask(taskHandle);

}

Error:

if( DAQmxFailed(error) )

DAQmxGetExtendedErrorInfo(errBuff,2048);

if( taskHandle!=0 ) {

 

DAQmxStopTask(taskHandle);

DAQmxClearTask(taskHandle);

}

if( DAQmxFailed(error) )

 printf("DAQmx Error: %s\n",errBuff);

 printf("End of program, press Enter key to quit\n");

getchar();

return 0;

}

 

 

thanks for helping me.

Use 80mhzTimetable for counting and how can i set a trigger level for a counter

$
0
0

Hello

 

i work with this example and a ni USB 6152.

 

#include <stdio.h>
#include <NIDAQmx.h>

#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else

int main(void)
{
	int         error=0;
	int			i=0;
	TaskHandle  taskHandle=0;
	int32       read;
	uInt32      data[1000000];
	char        errBuff[2048]={'\0'};

	/*********************************************/
	// DAQmx Configure Code
	/*********************************************/
	DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
	DAQmxErrChk (DAQmxCreateCICountEdgesChan(taskHandle,"Dev1/ctr0","",DAQmx_Val_Rising,0,DAQmx_Val_CountUp));
	DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"/Dev1/80MHzTimebase",80000000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000000));

	/*********************************************/
	// DAQmx Start Code
	/*********************************************/
	DAQmxErrChk (DAQmxStartTask(taskHandle));

	printf("Continuously reading. Press Ctrl+C to interrupt\n");
	while( 1 ) {
		/*********************************************/
		// DAQmx Read Code
		/*********************************************/
		DAQmxErrChk (DAQmxReadCounterU32(taskHandle,1000000,10.0,data,1000000,&read,NULL));

		printf("\rAcquired %d samples\n",read);
		
		for(i=0;i<1000000; i++)
		{
			printf("%d\r\n", data[i]);
		}
		fflush(stdout);
	}

Error:
	puts("");
	if( DAQmxFailed(error) )
		DAQmxGetExtendedErrorInfo(errBuff,2048);
	if( taskHandle!=0 ) {
		/*********************************************/
		// DAQmx Stop Code
		/*********************************************/
		DAQmxStopTask(taskHandle);
		DAQmxClearTask(taskHandle);
	}
	if( DAQmxFailed(error) )
		printf("DAQmx Error: %s\n",errBuff);
	printf("End of program, press Enter key to quit\n");
	getchar();
	return 0;
}

 

 

 But how can i work with the 80Mhz Timebase and set the trigger point to 0Volt?? I measure that the triggerpint is round 1,7 Volt.

 

I have a sinus signal who is varius between 0hz and 6khz. And need exact cointing and the default 100khz Timetabel ist not exact enouh. With my 1MHZ test signalhe doesn't count all .

 

How can i route the 80Mhz timetable to the counter as external clock for solving my problem..

 

Thanks for helping me.

The procedure entry point _palLogEvent could not be located in the dynamic link library NIPALU.dll

$
0
0

Good Day to all,

 

I have recently tried to do a emergency repair for my workstation.

 

It was running on Windows 2000 and I have to replace the system within C:\WINNT\System32\Config\

 

After that whenever I tried to run my program, it will give me an error message 'THe procedure entry point _palLogEvent could not be located in the dynamic link lbrary NIPALU.DLL'

 

Can anyone help?

 

I have re-installed my program and the drivers for my PCI-6023E.

 

I am running out of ideas.

 

Thank you in advance.

Error running NI-DAQmx ANSI C example in Windows 7 virtual machine

$
0
0

I am running a Windows 7 guest system with an Ubuntu 14 host, using VirtualBox, and have run into a problem running even the simplest examples provided by National Instruments, using the ANSI C API for NI-DAQmx.

The first time the DAQ Device is powered on, I can run a single measurement, and after that, any other measurement displays the following error message:

 

Attempted to read samples that are no longer available. 
The requested sample was previously available, but has since been overwritten. 
Increasing the buffer size, reading the data more frequently, or specifying 
a fixed number of samples to read instead of reading all available samples 
might correct the problem.

Property: DAQmx_Read_RelativeTo
Corresponding Value: DAQmx_Val_CurrReadPos
Property: DAQmx_Read_Offset
Corresponding Value: 0

Task Name: _unamedTask(0)
Status Code: -200279

 

In order to be able to start a new measurement, I have to restart the DAQ device, probably in order to clear any internal buffers that are being overridden.

I am interested in running a basic continuous voltage measurement using a callback function. (The ContAcq_IntClk example provided by NI)

The exact same configuration, same version of NI-DAQmx(9.7.5), and running on Visual Studio 2012, runs smoothly on a machine running Windows 7 directly.

I suspect the problem is with the internal buffer being somehow messed up because of the connection with the Virtual Machine, but can't figure out an elegant solution to fix it.

The device I am using is NI USB-6289.

status output of viRead in different situation

$
0
0

According to the VISA there are three possible success codes froma viRead operation: VI_SUCCESS, VI_SUCCESS_TERM_CHAR and

VI_SUCCESS_MAX_CNT. What is not clear to me is which one has precedence and how this depends on the value VI_ATTR_ASRL_END_IN, VI_ASRL_END_TERMCHAR, VI_ATTR_TERMCHAR and VI_ATTR_TERMCHAR_EN.

 

Where can I find a detailed explanation?

 

 

how to implement State of charge kalman filter algorithm in C code

$
0
0

hi,

 

I am going to implement kamlan filter algorithm in C code. Is anyone here did this before. Please share your ideas and tell me how i can implement this. Give me some ideas. It would be highly apreciate. thanks in advance

 

here i attached the kalman filter algorithm file.

 

regards,

usman


Calibration of SCXI1125

$
0
0

Hello,

 

I need to calibrate a SCXI1125 module using NI-DAQmxC in a VC++ application(MFC). I understand that I need to use "DAQmxAdjust1125Cal" and "DAQmxInitExtCal" functions, but I don't understand the method.

 

Do you have an example of code for doing this task?

 

Best regards,

 

E.Lemaistre

linking errors whlie running C examples of data acquisition using niScope and visual C++

$
0
0

hello,

 

I have an NI PXIe-1071 chassis with 2 PXI 5154 digitizer cards and NI PXIe 8102 controller.

 

I am trying to acquire data using the same. Right now I am trying to compile some of the C based examples given in the documentation of niScope. But I am unable to do so. for instance when I tried to run "ConfigureAcquisition.c ". I am having many errors like the one given below.

 

error LNK2019: unresolved external symbols _niScope_init@16 referenced in function _niScope_GenericConfiguredAcquisition@0

 

for every niScope based function used in the example it is showing the same error. 

 

I have only 2 files niScope.h and niScope.lib. In niScope.h there are declarations for each function but their definition is not there and I came to know that I also require source file of the same to avoid the error. Is this true????

 

if I dont reqire source file please suggest me how to avoid such errors. and if I require source file from where I could find it as I talked with NI people and one of the application engineer told me that this is not available with them. 

 

Please help me with the same.

 

regards

Sagar

动态创建UI控件,提示控件为试用版

$
0
0

用VS2008下,measurement Studio 8.6 编程,程序动态生成UI控件。

 

将程序打包后,在没有编程环境的计算机上安装,提示控件为试用版。

dynamic create UI control, prompt:evalution 30 days

$
0
0

I use VS2008 anf measurement studio 8.6. I execute to dynamic create UI control in the program.

 

Making the setup package and setuping in the computer in which there are not  the vs2008 and  measurement studio 8.6,

it prompts that the control is a evalution version limiting in 30 days when the program is creating the UI control.

How to seting the countre countreset?

$
0
0

This example can count forward.

//////////////////////////////////////////////////////////

void CCountDigEventsDlg::smileysurprised:nBnClickedStartButton()
{
// This example uses the default source (or gate) terminal for
// the counter of your device. To determine what the default
// counter pins for your device are or to set a different source
// (or gate) pin, refer to the Connecting Counter Signals topic
// in the NI-DAQmx Help (search for "Connecting Counter Signals").

CWaitCursor wait;

CNiString initialCountStr;
CNiString physicalChannel;

m_physicalChannel.GetWindowText(physicalChannel);
m_initialCount.GetWindowText(initialCountStr);

try
{
m_task = std::auto_ptr<CNiDAQmxTask>(new CNiDAQmxTask());

m_task->CIChannels.CreateCountEdgesChannel(physicalChannel,
"Count Edges",
m_edgeEnum,
atoi(initialCountStr),
m_countDirectionEnum);
DAQmxSetChanAttribute (m_task, physicalChannel, CountEdgesCountResetEnable, TRUE);
m_reader = std::auto_ptr<CNiDAQmxCounterReader>(new CNiDAQmxCounterReader(_T(m_task->Stream)));

m_task->Start();
SetTimer(1, 100, 0);

m_startButton.EnableWindow(false);
m_stopButton.EnableWindow(true);
m_stopButton.SetFocus();
}
catch(CNiDAQmxException *e)
{
e->ReportError();
e->Delete();

delete m_task.release();
delete m_reader.release();
}
}

///////////////////////////////////////////////////////////////////////

How to add code ? seting the countre countreset.

Viewing all 654 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>