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

NI Max

$
0
0

I installed NI Max and when I opened the software, it didn't work and pointed out  calling the necessary library mxrmcgf.dll fail.can anybody tell me how can I solve this problem,Thank you.

QQ截图20200924192102.png


NI vision builder C API code sample

$
0
0

Hi everyone,

 

I was hopping somebody from the community could share a Vision Builder C/C++ API  sample code.

 

It would be a great help. thanks

 

 

 

using C++ in place of Labview

$
0
0

Hi,

I want to use C++ to interact with NI modules.

I have visual studio installed and can run C++ programs without any issue.

But when I use commands like DAQmxCreateTask, it gives me error "identifier "DAQmxCreateTask"" is undefined.

What steps I should be taking to make it working? How can I find what is missing here?

where are located daqmx C libraries (or API)??

$
0
0

Hi all,

 

i have just installed nidqamx 20.1 with online installer, and i need to find where C libraries (API funcion) are located. I need to use these libraries with external C compiler, not with labview, but i can find their location. The help says that lib files are located in

NI-DAQ\DAQmx ANSI C Dev\include

 but i do not have that directory after installation. Rather that the online help says that these libs are located in directory:

National Instruments\Shared\ExternalCompilerSupport\C\

 unfortunately i have non of those directory in my "national instrument" folder, i just have something similiar that is

C:\Program Files\National Instruments\Shared\mxef

 which contains some similiar libraries, but i don t know whic one i have to link to my project. Please give some ideas,

 

Kind Regards

Emanuele Peruzzi

How to configure multiple AI channels scanning at differerent rates in Visual C++

$
0
0

Hi,

is it possible to scan multiple AI channels (e.g. 😎 at different sampling rates each of them?

If yes, I am intersted in knowing the DAQmx C++ function that should be used to configure the rates this way.

I am using NI USB 6000-6001-6002 series cards.

Thanks.

how to check if measurement is done through SRQ

$
0
0

Here is the code, but it doesn't work, can anybody help?

 

main()

{

status = viOpenDefaultRM(&defaultRM);
status = viOpen(defaultRM, "GPIB0::18::INSTR", VI_NULL, VI_NULL, &viSA);
viSetAttribute(viSA, VI_ATTR_TMO_VALUE, 20000);
viClear(viSA);

viInstallHandler(viSA, VI_EVENT_SERVICE_REQ, myCallback, bufferHandle);
viInstallHandler(viSA, VI_EVENT_IO_COMPLETION, myCallback, bufferHandle);
viEnableEvent(viSA, VI_EVENT_SERVICE_REQ, VI_HNDLR, VI_NULL);
viEnableEvent(viSA, VI_EVENT_IO_COMPLETION, VI_QUEUE, VI_NULL);

//start porform channel power measurement....

viPrintf(viSA, ":INITiate:CHPower\n");
status = viWaitOnEvent(viSA, VI_EVENT_IO_COMPLETION, 30000, &etype, &eventContext);

 

if (status < VI_SUCCESS) {
/* Waveform not received...exiting */
free(bufferHandle);
viClose(defaultRM);
return;
}

//try to fetch channel power here, but it never get there.

viPrintf(viSA, ":FETCH:CHP:CHP?\n");
viRead(viSA, (ViBuf)buf, 20, &numRead);
}

 

//callback

ViStatus _VI_FUNCH myCallback(ViSession vi, ViEventType etype, ViEvent eventContext, ViAddr userHandle)
{

ViJobId jobID;
ViStatus status;
ViUInt16 stb;
status = viReadSTB(vi, &stb);
status = viReadAsync(vi, (ViBuf)userHandle, 1024, &jobID);
return VI_SUCCESS;

}

 

USB-6001 analog output with external trigger, not able to let it work.

$
0
0

Hello,

 

i m trying to configure a signal output through Ao port. Im using USB-6001 device with C++ software.

I want to use Ao port 0 for this application, and P1 line3 as digital signal, and PFI0 as trigger for outputting data from Ao port. P1 line3 is externally connected to PFI0 input with cable.

The problemis that when i set P1 line3 high, i see with scope that it goes high, but Ao0 does not put data out. External trigger on PFI0 does not work correctly.

Here is my code:

 

// task DO
DAQmxCreateTask("TASKDO",&taskDOH); // create task
DAQmxCreateDOChan(taskDOH,"Dev1/port1/line3","",DAQmx_Val_ChanForAllLines); // create DO on port 1 line 3

DAQmxStartTask(taskDOH); // start task
DIO_p2_l3[0] = 0; // set digital data to 0
DAQmxWriteDigitalLines(taskDOH,1,false, 10.0,NON_INTERLEVAED,DIO_p2_l3,nullptr,nullptr); // write data on P1 line 3

// task 2
DAQmxCreateTask("Task2",&task2H); // create task for Ao
DAQmxCreateAOVoltageChan(task2H,"Dev1/ao0","",-10.0,10.0,DAQmx_Val_Volts,nullptr); // create analo output channel
DAQmxCfgSampClkTiming(task2H,"OnboardClock",1000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,1000); // internal clock
DAQmxCfgDigEdgeStartTrig(task2H, "/Dev1/PFI0", DAQmx_Val_Rising); // set PFI0 as trigger for Ao

DAQmxRegisterDoneEvent(task2H,0,FineTask,this); // register callback for task finished

DAQmxWriteAnalogF64(task2H,1000,false,10.0,DAQmx_Val_GroupByChannel,DataWrite,nullptr,nullptr); // write data to Ao

DAQmxStartTask(task2H); // START TASK Ao

// send trigger
DIO_p2_l3[0] = 1; // set data to 1
DAQmxWriteDigitalLines(taskDOH,1,false, 10.0,DAQmx_Val_GroupByChannel,DIO_p2_l3,nullptr,nullptr); // write p1 line 3

what i am doing wrong?? please give some hint.

 

Kind Regards

Visual Studio Code C / C ++

$
0
0

bonjour, j'utilise visual studio 2019 c ++ et je souhaite essayer c. vs 2019 ne prend pas en charge c, uniquement c ++. comment est-ce avec c / c ++ dans visual studio code? la liaison est-elle similaire à visual studio 2019? j'ai vu de mauvaises reviews sur c / c ++ pour vs code. cela fonctionne-t-il correctement? merci


MAX - Panel Configuration n'affiche rien?

$
0
0

Bonjour,

J'ai un problème avec le logiciel Measurement and Automation Explorer. Lorsque j'ouvre l'application, rien ne s'affiche dans le panel de gauche 'Configuration', là où je devrais trouver les différents périphériques et interfaces branchés sur mon PC. Il m'est donc alors impossible de contrôler mes périphériques. 

Savez-vous comment régler ce problème ? Si jamais c'est un problème de driver ou autre ?

Cordialement,

C++如何获取板卡的物理通道列表

$
0
0

labview提供了控件自动获取,那么C++如何调用NIDAQMX驱动的函数获取板卡的物理通道列表,希望有好心人回答一下,感激不尽。

split PFI input signal

$
0
0

Is to possible to split one input:PFI1 in to two output:PFI2 and PFI3?

 

I had success try PFI1 route to PFI2 by using "DAQmxConnectTerms". It can work for 1to1 instead of 1to2.

 

請問能不能將一個input訊號拆分成多個output訊號呢?

 

NI 9403 Write Digital Line

$
0
0

Hello,

 

I have a NI 9403 DIO card within my DAQ.  I am trying to use the write digital lines command to send a pulse whenever I need to (or whenever my code says I need to send a pulse).

 

The problem I am running into is the time it take between commands (approximately 10ms as the minimum).  Here is my code.  I pause between the commands for 1ms, but pauses below 10ms just result in a 10ms lag anyways.  Preferably I would like to send these commands to my card much faster, but once again, the rate can change fairly often.  Any help would be appreciated.  Thanks,

 

DAQmxErrChk(DAQmxCreateTask("", &taskHandle2));
DAQmxErrChk(DAQmxCreateDOChan(taskHandle2, "cDAQ2Mod4/port0/line8:13", "", DAQmx_Val_ChanForAllLines));

DAQmxErrChk(DAQmxStartTask(taskHandle2));

DAQmxErrChk(DAQmxWriteDigitalLines(taskHandle2, 1, 1, 0.0, DAQmx_Val_GroupByChannel, data, NULL, NULL));

std::this_thread::sleep_for(std::chrono::milliseconds(1);

DAQmxErrChk(DAQmxWriteDigitalLines(taskHandle2, 1, 1, 0.0, DAQmx_Val_GroupByChannel, data, NULL, NULL));

LoadLibrary( 'nidaq32.dll') is spoiled by missing 'nipxi5600u.dll'

$
0
0

Hello all,

 

we have a decades-old legacy VC++ application, running perfectly under any Windows version up to 7 with the traditional ni-DAQ drivers, including version 7.5 (nidaq32.dll is of size 2818048 bytes), while the DLL is implicitly loaded at start of the program.

 

Now we have been porting this C++ project under Windows 7 to using both the new ni-DAQmx drivers and the traditional DAQ. While explicitly LoadLibrary( 'nicaiu.dll') works fine and our code successfully uses the new driver, the traditional driver can't be loaded in the same way.

 

The call to LoadLibrary(  'nidaq32.dll') returns a valid library handle, but at the same time GetLastError() returns 2: ERROR_FILE_NOT_FOUND (although, of course, C:\Windows\System32\nidaq32.dll exists). Afterwards, subsequent calls to GetProcAddress() return null pointers and another GetLastError() says 126: ERROR_MOD_NOT_FOUND.

 

Using the program Dependency Walker, version 2.2.6000 to profile the DLL usage of our application reveals that one of the DLL dependencies, 'nipxi5600u.dll', could not be met. When starting our old program with implicitly loading 'nidaq32.dll', this miss is not an error, because 'nipxi5600u.dll' is never used (We don't have that hardware, PXI5600, anyway).

 

But when explicitly calling LoadLibrary( 'nidaq32.dll'), this miss gives a fatal error. Our program recovers with the traditional DAQ not loaded, but is of course not able to perform anything afterward.

 

Why is this dependency 'nipxi5600u.dll' incorporated in 'nidaq32.dll', while not distributed together with the TDAQ driver? Of all that many NI devices, this looks like the only one mentioned in the dependency list of 'nidaq32.dll', although one does not own that device and that particular driver is not distributed along.

Is it an error that 'nidaq32.dll' expects this 'nipxi5600u.dll'? Is there any viable workaround?

 

With best regards,

C. Spanheimer

 

How to set the number of samples to process per second??

$
0
0

I created the source as below...

 

DAQmxCreateTask("", &m_task[0]);
DAQmxCreateAIAccelChan(m_task[0], "cDAQ9189-1DD988AMod1/ai0:2, cDAQ9189-1DD988AMod2/ai0:2, cDAQ9189-1DD988AMod3/ai0:2, cDAQ9189-1DD988AMod4/ai0:2, cDAQ9189-1DD988AMod5/ai0:2", "", DAQmx_Val_PseudoDiff, 0.0, 200.0, DAQmx_Val_AccelUnit_g, 50, DAQmx_Val_mVoltsPerG, DAQmx_Val_Internal, 0.004, NULL); DAQmxCfgSampClkTiming(m_task[0], "", 100, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000); DAQmxRegisterEveryNSamplesEvent(m_task[0], DAQmx_Val_Acquired_Into_Buffer, 100, 0, EveryNCallback, this);
DAQmxStartTask(m_task[0]);

I thought there were 100 samples per second of the sample collected 100, callback sample 100, but there is not.

How do I need to implement it in code?
I want to receive only the specified number every second.

MAX - Panel Configuration n'affiche rien!

$
0
0

Bonjour,

J'ai un problème avec le logiciel Measurement and Automation Explorer. Lorsque j'ouvre l'application, rien ne s'affiche dans le panel de gauche 'Configuration', là où je devrais trouver les différents périphériques et interfaces branchés sur mon PC. Il m'est donc alors impossible de contrôler mes périphériques. 

Savez-vous comment régler ce problème ? Si jamais c'est un problème de driver ou autre ?

Cordialement,


Visual Studio Multiple Continuous Digital Output 9403

$
0
0

Hello,

 

I am trying to output three different continuous signals through a single task on a Digital output device NI 9403.

Essentially, one is pulsing high or low, while the others are constantly high.  However, I cannot seem to get this to output correctly.  From all the documentation I read and example code I look at, this appears to be right.  Please let me know if anyone sees anything wrong.  Thanks,

 

int32 error = 0;
TaskHandle taskHandle = 0;
uInt32 dataStep[30];             // Buffer of 30, 10 per line
char errBuff[2048] = { '\0' };

 

// Create the Digital output task for three lines

char const* PortName = "cDAQ2Mod4/port0/line8,cDAQ2Mod4/port0/line10,cDAQ2Mod4/port0/line13";
DAQmxErrChk(DAQmxCreateTask("", &taskHandle));
DAQmxErrChk(DAQmxCreateDOChan(taskHandle, PortName, "", DAQmx_Val_ChanForAllLines));

 

// Setting up the output data.  Again, first 10 is a pulse wave, second two are consistently 1

int cc = 0;
for (int i = 0; i < 10; i++) // Pulse
{
if (cc == 0)
cc = 1;
else
cc = 0;
dataStep[i] = cc;
}

for (int i = 10; i < 20; i++) // High or Low for Direction
dataStep[i] = 1;

for (int i = 20; i < 30; i++) // Always 1 for power on
dataStep[i] = 1;

 

// Set timer to 100Hz

DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandle, NULL, 100.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 100));

 

// Write the buffered data.  Group by channel, so first 10 to first line, second 10 to second line, third 10 to third line
DAQmxErrChk(DAQmxWriteDigitalU32(taskHandle, 10, 0, 0.0, DAQmx_Val_GroupByChannel, dataStep, NULL, NULL));

 

// Start Continuous Task until stopped

DAQmxErrChk(DAQmxStartTask(taskHandle));

 

Triggering NI SCOPE detect rising and falling edge

$
0
0

can i setup triggering for NI-scope based on rising and falling edge at the same time? When i check niScope_ConfigureTriggerEdge, i can only select NISCOPE_VAL_POSITIVE or NISCOPE_VAL_NEGATIVE, can't select both.

 

System

  1. PXIe-1082 chassis
  2. PXI-5122 oscilloscope

 

 

USB-8502 CAN fail to read ?

$
0
0

We are using USB-8502 for CAN communication with our motor. we have write some code to write and read the can data.

the code runs fine at first, but the USB-8502(Port2) fail to read after 10 minute.

we try to read the data from X-Net Monitor instead of using the code, but USB-8502 fail to read data with X-Net as well.

Below is the application for our code:

Port1: reading and write alternately .(No failure found)

Port2: reading and write alternately with a background thread.(fail to read after some time.)

Attached is some test we do to analysis the failure(Monitor the CAN data with another Peak-System CAN):

Picture1: Write with X-Net using Port2, the data send out normal. and we get reply (0x581h).

Picture2: Write with Peak-System CAN, check the if there is data received from USB-8502.(there is reply from the monitor but the X-NET fail to read)

This situation continue until we plug off/on the USB connector.

We know that this should have something related to our code, but we are wondering: 

What kind of error would cause USB-8502 fail to read till a reset?

NS-VISA not in GAC issue

$
0
0

We've been running a C# test program with NI for awhile on a few computers but one computer isn't cooperating. The program requires NI-VISA version 17.5 along with the .NET Framework 4.0, which was successfully installed on the computer. However, when it runs it immediately comes up with the following error:

 

"Unable to install or run application. The application requires that assembly NationalInstruments.VisaNS Version 13.0.45.167 be installed in the Global Assembly Cache (GAC) first."

 

Anyone ever see this and/or know how to fix this issue?

Ni_ReadBinaryI16 not working anymore

$
0
0

hi everyone,

i read from an USB-6210 and have not touched my c++ code in years. it suddenly does not work properly anymore, x values appear to be dampened, variing less than they should.

what could have changed in recent months?

DAQmxErrChk (Ni_ReadBinaryI16(taskHandle, numSamples, 10.0, DAQmx_Val_GroupByScanNumber, data, numSamples*numChannels, &read, nullptr));

thank you!

Viewing all 653 articles
Browse latest View live


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