Do I need NI card to use NI-DAQmx to get measuring from Foundation Fieldbus device in my c# application? Connection to FF device is via USB Fieldbus Interface.
Do I need NI card to use DAQmx in my c# ?
NI USB-6009 and Tek's TDS2024C comparesment
My apologies if this topic has already been discussed, but I searched through forum and manuals and couldn't find anything.
I have a problem with measurements made in parallel with NI USB 6009 and Tek's TDS2024C.
I measured high frequency noise on 10 s window.
I used data logger with 40 kHz frequency logging in parallel with TDS2024C (which achieved 250 Hz on 10s window) and got significantly different results.
On figure in attachment, first signal is from scope screenshot data, and the second islogged data from NI USB 6009.
Can someone explain me why are these results so different?
Daqmx write property: TotalSampPerChanGenerated
I've modified the ni example program (something like daqmx AO continuous non-regenerate) and I have noticed it is not displaying what I was expecting to see. Here is a list of what I have done to it:
-added AO buffer vi and set to 100,000 samples
-sample rate 100,000
-sample to write per iteration to 2,000
-added TotalSampPerChanGenerated after start task vi
-added Space Available in Buffer attribute
Hardware: NI 9269, cdaq 9188
During the run I was expecting the TotalSampPerChanGenerated would increment by 2,000 after every iteration but what I got was 1,xxx (x being any number from 0 to 9). Reading the number of samples written per channel terminal from the write vi showed a different result of 2,000.
If left running for a long time the space available in buffer attribute will gradually decrease and I imagine it will eventually become an overflow error.
Also when generating a pps of my own with reference to gps pps I can see that it slowly lags behind the gps pps.
What can I do to ensure the daq is writing the correct number of samples because I assume it is reporting the correct amount (though not what I want to see) since space available in buffer is slowly being drained over time?
Here is a similar issue some one else posted in 2009
Thanks
analog input/sync problem
hello all,
I am using USB-6363 CVI 2013 with patches, and being trying to solve this problem for days. But just can't find out what the problem is.
Basically I have an analog outputing finite periods of sine wave ( which works fine) , then I would like to receive it ( or other stuff) at an analog input port for testing purpose.
The thing is I can't get anything from the AI port, straight zeros in that array. I tried to set DAQmxCfgAnlgEdgeStartTrig on the AI0 port but still no results. and at this moment
I don't have the ability to test whether APFI0 method will work or not. So right now I am on a internal trigger.
Here is what I got so far, no errors. But all I see on the resulting array sinearrayfin is zeroes. sinearrayf is the input and tested to have data in it.
sinearrayf = (float64 *)malloc(800*arraysize4* sizeof(float64));
for (int f=0;f<800*arraysize4;f++)
{
sinearrayf[f] = (float64) sinearray[f];
}
sinearrayfin = (float64 *)malloc(800*arraysize4* sizeof(float64));
for (int f=0;f<800*arraysize4;f++)
{
sinearrayfin[f] = 0;
}
int error=0;
char errBuff[2048]={'\0'};
char trigName[256];
int32 written=0;
DAQmxErrChk (DAQmxCreateTask("",&AItaskHandle));
DAQmxErrChk (DAQmxCreateAIVoltageChan(AItaskHandle,"/Dev1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(AItaskHandle,"",800000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,800*arraysize4));
DAQmxErrChk (GetTerminalNameWithDevPrefix(AItaskHandle,"ai/StartTrigger",trigName));
DAQmxErrChk (DAQmxCreateTask("",&AOtaskHandle));
DAQmxErrChk (DAQmxCreateAOVoltageChan(AOtaskHandle,"Dev1/ao0","",-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(AOtaskHandle,"",800000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,800*arraysize4));
DAQmxErrChk (DAQmxCfgDigEdgeStartTrig(AOtaskHandle,trigName,DAQmx_Val_Rising));
DAQmxErrChk (DAQmxWriteAnalogF64(AOtaskHandle,800*arraysize4,0,10.0,DAQmx_Val_GroupByChannel,sinearrayf,&written,NULL));
DAQmxErrChk (DAQmxRegisterDoneEvent(AOtaskHandle,0,DoneCallback,NULL));
DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(AItaskHandle,DAQmx_Val_Acquired_Into_Buffer,10000,0,EveryNCallback,NULL));
/*********************************************/
// DAQmx Start Code
/*********************************************/
DAQmxErrChk (DAQmxStartTask(AOtaskHandle));
DAQmxErrChk (DAQmxStartTask(AItaskHandle));
Error:
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuff,2048);
if( AItaskHandle!=0 ) {
/*********************************************/
// DAQmx Stop Code
/*********************************************/
DAQmxStopTask(AItaskHandle);
DAQmxClearTask(AItaskHandle);
}
if( AOtaskHandle!=0 ) {
/*********************************************/
// DAQmx Stop Code
/*********************************************/
DAQmxStopTask(AOtaskHandle);
DAQmxClearTask(AOtaskHandle);
}
if( DAQmxFailed(error) )
printf("DAQmx Error: %s\n",errBuff);
.......
int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData)
{
int32 error=0;
char errBuff[2048]={'\0'};
static int totalAI=0;
int32 readAI;
DAQmxErrChk (DAQmxReadAnalogF64(AItaskHandle,-1,10.0,DAQmx_Val_GroupByChannel,sinearrayfin,800*arraysize4,&readAI,NULL));
fflush(stdout);
return 0;
}
Interfacing a differential probe to NI USB-6281
Hi,
We have a differential probe designed to be connected to an oscilloscope, so the connection to the scope is 1 MOhm.
We want to connect this probe to a NI USB-6281, what is the correct way to do it ?
Please post your comments/suggestions.
David.
how to acquire one sample per trigger, aperiodically?
Hello, I am struggling to write a VI that would acquire one analog voltage sample every time an aperiodic TTL trigger is detected.
Trigger events are aperiodic; their rate can change from 0.2 Hz to 1 kHz unpredictably from sample to sample. The experimental setup is complex (hence the aperiodicity), but the important part is that there is a hardware voltage averager that provides two outputs: analog Data Out and digital Busy. When Busy signal goes down, Data Out is valid and must be read within 1 ms. Then the rest of experimental setup may or may not reconfigure itself for the next measurement, and the averager presents the next data point.
I am using NI USB-6009 with Labview 2013. USB-6009 samples up to 48K samples per second; it has a single PFI0 input that can be used as digital trigger input and 8 analog inputs.
A simple-minded solution I had involved setting up an AI Voltage task with PFI0 as source to Start Trigger, performing one read, shutting down the task and repeating everything right away. This sounds very inefficient to me, especially at 1kHz frequencies.
Another idea was to set up continuous AI voltage acquisition, where PFI0 was wired as the source to the Sample Clock. However, this throws an error -89136: Specified route cannot be satisfied because hardware doesn't support it. I can't tell whether I coded something stupid or I am using inadequate hardware.
I am out of ideas, and I am a DAQmx noob, so any help is greatly appreciated.
What version of the DAQmx driver is compatible with DAQmx 8.5.11.22
Hi;
I have a a new software in charge.
It's including NAtionalInstruments.DAQmx V8.5.11.22 and NationalInstruments.Commun V8.1.11.168.
Does somebody know what is the driver version, that I need to install before deploying ?
Regards
Join: the error shown at runtime
Is it possible to maintain the last AO value after the DAQmx task is done on device DAQ USB-6341 ?
Hi all,
I use the device DAQ USB-6341 to generate the desired voltage waveform by the "finite samples" sample mode.
I notice that the channel resets to zero volts after the DAQmx task is done and the DAQ USB-6341 does not have
the property AO.idleOutputBehavior to select "Maintain Existing Value".
How can I maintain the last AO value after the DAQmx task is done on device DAQ USB-6341 ?
Thanks.
Godel
Feedback system for servo valve
Hi all,
I'm new to Labview and I'm struggling a lot. I have been to Labview beginner courses and also talked to Labview hotline a lot of times. All in all I have put a lot of effort in trying programming Labview for the past months, but I'm unfortunately not succeeding. This is very frustrating and I would be thankful if one could spent some time helping me out. I have searched for other posts and looked through documentation already, but I need a little more guidance. If you have relevant links, you are most welcome to post them in this thread and I will look into it. Also if this thread is posted in the wrong subforum please feel free to move it.
I have a system with a servo valve. This servo valve controls the flow direction of pressurized hydraulic oil going to a piston. I want to send a sine wave signal to the servo valve resulting in the oil changing direction periodically. This will in effect send the piston up and down periodically. On the piston rod I have mounted a strain-gage measuring the corresponding force transmitted. I would like to built a Labview program, there is;
1) Generating a sine wave signal to the servo valve.
2) Acquiring a corresponding force signal from the strain-gauge on the piston rod.
Take these two enqueued arrays of data and do two things;
a) Save them on the computer in a specified folder in an Excel spread sheet, with corresponding time stamps for each measurement.
b) Plot the data live in Labview.
It's important for me, that there is no lag between the data generated and the data acquired. Elseway I can't use it for analysis.
I would like to keep it simple, thereby the generated signal can start of as a constant value, then later on be altered to a sine wave and then finally be modified to the proper frequency.
When this is all set, I would like to expand the system to cope with the feedback requirement. Hereby implementing a way to control the signal generated from the information gained from the acquried force. This is done in order to gain a precise signal and minimize overshooting and the like, like in a PID setup.
So what i want is, continuous measurement and data logging.
Hardware setup:
I'm using a NI cDAQ-9178 (Compact DAQ) with 8 bays. Connected to the computer with a USB cable.
The module for the servo valve, generating a signal is a: NI 9265
The servo valve is a Direct Operated Proportional DC valve from Parker called DF plus, series D1FP with ID number: D1FPE50FB9N500. It's controlled by a current signal from 4 to 20 mA where 12mA is closed.
The module for the strain-gage, acquring a signal is a: NI 9237.
The strain-gage is a HBM U9C 20 kN (=kilo Newton) which has been calibrated from factory and comes with a test certificate with values to set the input quantities (load) and corresponding output quantities (mV/V)
A screw terminal adaptor NI 9949 is connected between the strain-gage and module with a ethernet cable.
Software:
I'm using Labview 2012 SP1 (32-bit)
My approach
I started setting up a minor Labview program for generating the sine wave signal using the built in DAQ assistant. I then made another program likewise for acquring the force signal. I then tried to put the two programs together, but it found it hard. Also I found there were some limits using the DAQ assistant. Making it a good choice for fast testing, but not for using in the final program. I had issues getting the data from the two signals in sync. I.e. there was some lag, also I found they did not produce data at the same rate.
Now I'm looking into the template: "Continuous Measurement and Logging (NI-DAQmx)". This template is built on the Queued Message Handler and uses the producer consumer loop approach. Here queues are used to control data from different sources can be handled. I have altered this slightly by adding the right physical channel for my strain-gage. It is however a very large program with a lot of sub VI's making it difficult for me to grasp it all. As a start I would like to change the units for the signal I'm receiving to Newton. Also I would like to use the calibrated data from my certificate to get the gain and offset right.
The VI template can be found in Labview please let me know if I should attach it. Also I have a figure of the hydraulics circuit if needed just let me know.
Best regards
Anders
AMUX-64T and MAX
Hi!
I have several applications I developed in LabWindows/CVI for NT/2000/XP. They've worked fine until recently.
My last XP computer has been replaced, and I can't get the anything to work with Win7 and TradDAQ7.5.
I have two PCI cards, 6034E connected to an AMUX-64T, and a 6052E connected to a BNC2090.
MAX lets me set everything up correctly, but my readings are garbage.
I'm not sure what to do at this point.
Carl
EveryNSamplesCallback Function Called after DAQmxWaitUntilTaskDone
Hello All,
I'm reading data from a file on my computer and trying to produce Analog output via PXI-6733. My codes works well for the most part except the EveryNSamplesCallback function is called an additional time. Below is the most relevant part of the code.
iTotalIterations=iNumSamples/EVERY_N_SAMPLES; // Floor iTotalIterations /*********************************************/ // DAQmx Configure Code /*********************************************/ DAQmxErrChk (DAQmxCreateTask("",&taskHandle)); DAQmxErrChk(DAQmxCreateAOVoltageChan(taskHandle,acChanNum,"",-10.0,10.0,DAQmx_Val_Volts,NULL)); DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandle,"",SAMPLE_RATE,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,iTotalIterations*EVERY_N_SAMPLES)); DAQmxErrChk(DAQmxTaskControl(taskHandle,DAQmx_Val_Task_Commit)); DAQmxErrChk (DAQmxCfgOutputBuffer(taskHandle,BUFFER_SIZE)); // BUFFER_SIZE=EVERY_N_SAMPLES*4; DAQmxErrChk(DAQmxRegisterEveryNSamplesEvent(taskHandle,DAQmx_Val_Transferred_From_Buffer,EVERY_N_SAMPLES,0,EveryNSamplesCallback,NULL)); DAQmxErrChk (DAQmxSetWriteRegenMode(taskHandle, DAQmx_Val_DoNotAllowRegen)); for(i=0;i<4;i++) { //Get afData64 DAQmxErrChk(DAQmxWriteAnalogF64(taskHandle,EVERY_N_SAMPLES,0,-1,DAQmx_Val_GroupByChannel,afData64,NULL,NULL)); } // Buffer Full. Start Task DAQmxErrChk(DAQmxStartTask(taskHandle)); // Continue Task Until Iterations are completed // iCurrentIteration is global; updated in EveryNSamplesCallback while(iTotalIterations>=iCurrentIteration) { // Wait for EveryNSamplesCallback to be called and executed } printf("|\nEmptying Output Buffer...\n"); DAQmxErrChk(DAQmxWaitUntilTaskDone(taskHandle,-1));
If I print iCurrentIteration at the end of the code snippet, it always one greater than iTotalIterations. Call to DAQmxWriteAnalogF64 in my EveryNSamplesCallback looks exactly same as above.
Can someone help me with understanding the reason behind an additional call to EveryNSamplesCallback Function? How can I avoid it?
Thanks.
How to generate independent analog signals simultaneously on one board?
Hello!
With my PCIe-6321 board I'd like to generate two independent analog signals at the same time.
Meaning:
The first signal has to run in "continuous" mode all the time without interruption.
The second signal has to be generated in "finite samples" mode upon certain software or hardware trigger events.
They may both share the same sample clock.
The question:
Is it possible at all to do this on a single I/O-board (such as the PCIe-6321)?
I have tried to set that up using the AO0 and AO1 channels. However the second task to be started just returns with an error, stating that required recources have already been reserved by the first one.
Would appreciate any hints and ideas.
Best regards,
Sebastian
cable for usb 6008
Hi friends,
What is the properties of cable which used to connect Analog I/O or Digital I/O of USB 6008? How must be selected a cable?
have a nice work
USB-6210
Hi!
We just bought a USB-6210 DAQ device which we could proper install and it is also nicely listed in the NI device Monitor.
So, we just connected the 6210 via USB to our Win7 Pro, 64bit machine and wanted to see if its works.
We opened NI Max (Ver. 14.5), our device is recognized and we opened a "Test Panel". We should see nothing but noise as we didn´t connect anyhing at all to the device. But we see a lot of crazy things. Our analog inputs are starting to raise and to saturate at around 11V. Some other inputs decrease from 11V slowly towards 0....
However, we connected a photoreceiver (thorlabs) to aquire some signals....nothing is showing just all the same strange signals.
We switched back to our USB-6000 device and everything works. With the USB-6210 we do not get anything.
Any ideas?
thanks
usb 6501 unresponsive causing BSOD(Blue Screen Error)
There are a lot posts about the same issue but mine is a little peculiar so i decided to post it.
I am using two usb DAQ in the same pc(usb-6501, usb-6001), connected to the usb port on the back. The usb-6501 is used to obtain digital inputs from read switches, Sensors through an ssr. The usb-6001 is used to control 2 double valve solenoid, 1 dc motor, 2 indicator lamps. usb-6001 is also used to read analog values of current(using hall effect sensor) and voltage(using potentiometer).
At first i was facing problems with the usb-6001(the usb-6501 was working fine at this point) resetting during operation accompanied by BSOD. Then i learned it was due to my relay, which requires 30 mA of current to switch so i used the ULN2003a to interface the usb-6001 with the relays and after that the application was running perfectly for 4 days.
Now the usb-6501 is having the same problem and when i perform "Self Test" from NI MAX it shows "Error Code:50405" and i am able to reset the device from NI MAX only sometimes, other times i would have to unplug the USB device then plug it back in. As the application is used for an automated test rig the customer is frustrated by this problem. Once the card becomes unresponsive(or after the card is reset) BSOD occours.
I have checked all the device drivers and OS for any errors but they are fine. i have even tried changing the ram to solve the BSOD with no use.
System Details:
- Windows 7 SP1
- NI MAX 14.0
- power saving is disabled
I have attached the latest mini dump files as they might help in finding out the reason behind this problem(File extensions changed for the purpouse of uploading).
I need to know: Is there any permanent solution for this problem? and what is the reason for this problem.
NI-9402 on a cDAQ-9178 not reading frequency from a counter input channel
Hello,
I am using a NI cDAQ-9178 with the NI-9205 (in slot 1) and NI-9402 (in slot 2). I have a (Keysight 33220A) function generator generating a square wave at 100Hz (@5Vpp) and is connected to the ci0 of the NI-9402 module. The output of the function generator has been verified with an oscilloscope.
I am having trouble reading the frequency using a counter input channel. I am executing the DAQmx ANSI C example that shipped with NI-DAQmx version 14.5 named "Dig Freq-Low Freq 1 Ctr". Below is the error message that I observe when I attempt to execute the code:
DAQmx Error: Specified operation did not complete, because the specified timeout expired. Task Name: _unnamedTask<0> Status Code: -200474 End of program, press Enter key to quit
I have attached the corresponding C file to this post. I have NIDAQmx driver version 14.5 installed on my machine.
Is this a regression in the driver or a limitation in the NI hardware modules? If this is a bug in the driver, can you please provide a CAR # related to the bug.
PS: I am able to use the NI tool to count edges using the exact same setup.
Thanks,
Varun Hariharan
The MathWorks
DAQ task channel order (PXIe-4498)
I have a PXIe-4498 for which I programmatically generate an acquisiiton task.When the task is built the channel order is not necessarily in ascending channel number.
My question is whether the DAQ card will return the data in the order in which I defined the task or in channel order?
Thanks
Labview System in Car for Multiple Days
Hello All,
We are attempting to have a DAQ run in a trailer measuring displacement and loads for three multiple days.
In our previous testing we used seven NI 9236 strain modules and one NI 9205 analog input module, which are plugged into a CampactDAQ ethernet chassis. This chassis is then plugged into a laptop that runs our software. This was all done indoors, where we could use a standard wall plug for power supply.
I was wondering if there was anyway that we could make this same system run for 3 straight days, where half of the day the DAQ will be powered by the truck power supply, but during nights, the system would have to run off of a 10VDC power supply or similar power supply.
Does anybody have any ideas of how to power the system or any external power supplies that would be able to last three days while the system is running?
Thanks!
Sample Project with ni hardware using NI-DAQmx Driver
hi, i need a Sample Project with NIi hardware using NI-DAQmx Driver
USB 6211 Driver Problem
My problem is sth similar to this:
but I decided to open a new thread because that one is too old.
The driver works fine almost all the time, but there is an annoying problem happens when this sequence is followed right after device is plugged:
1. Plug usb 6211 device to usb port
2. start NI-Max or Matlab immediately, dont wait for 'USB 6211 detected' message. (anything uses the drivers)
3. Device driver is not loaded, instead 'usb driver loader' appears at device manager and NI max.
I tried rescanning, resetting the hub at which daq is connected(using devcon), but no luck. The only way to get it working again was to cut power from the DAQ, wait for some time and re-plug.
I can detect if this situation happens in software using devcon and system calls, but I want to fix it in software. Can you help me in this?I hope my question is clear.
Thanks