 newbi
		
			newbi
		
		
		
		
		
		
		
		
	
			07-23-2008 08:19 AM
07-28-2008 05:26 AM - edited 07-28-2008 05:30 AM
 cesarabravop
		
			cesarabravop
		
		
		
		
		
		
		
		
	
			01-14-2009 10:14 AM
Hi there
I think my problem is very similar to the discussion in this thread.
I have a NIUSB6210 pluged on a openSuSE Linux box with USB 2.0 (USB 1.0 on developing hardware).
I am trying to sincronize continuos (slow) analogic input and digital triggered fast analogic waveforms.
Is this possible WITH THIS HARDWARE NIUSB6210?
Do you have a handy example C/C++ DAQmxBase to show me?
Thanks in advance
César Bravo
 sahpe
		
			sahpe
		
		
		
		
		
		
		
		
	
			01-27-2009 11:37 AM
Hello Cesar,
You can have a look at the C Reference Help that was installed with your DAQmxBase driver on your PC, or try the following locations for examples:
I hope this helps,
Kind Regards, 
Michael S.
Applications Engineer
NI UK & Ireland
 cesarabravop
		
			cesarabravop
		
		
		
		
		
		
		
		
	
			01-27-2009 12:34 PM
Hi Michael
I just compiled the example:
/usr/local/natinst/nidaqmxbase/examples/ai/acquireNScans-DigRef.c
But when try to run it, the followin error raises:
/usr/local/natinst/nidaqmxbase/examples/ai ./acquireNScans-DigRef 
DAQmxBase Error: Specified property is not supported by the device or is not applicable to the task.
the error happens in the call:
DAQmxErrChk (DAQmxBaseCfgDigEdgeRefTrig(taskHandle,triggerSource,triggerSlope,triggerSamples));
and I just notices that there is a wrong value on the code:
uInt32 triggerSlope = DAQmx_Val_RisingSlope;
so I change it to:
uInt32 triggerSlope = DAQmx_Val_Rising;
but the error remais. 
The manual states clearly that NIUSB6210 does support ReferenceTriggers.
Can you help me to solve this problem?
Or the NIUS6210 DO NOT SUPPORT Reference Triggers?
I would like to get a WORKING EXAMPLE on how to access NIUSB6210 through VISA on LINUX.
Regards
César
P.S. The code follows in attach and at the end of this message.
 /*********************************************************************
 *
 * ANSI C Example program:
 * acquireNScans-DigRef.c
 *
 * Example Category:
 * AI
 *
 * Description:
 * This example demonstrates how to acquire a finite amount of data
 * using a digital reference trigger.
 *
 * Instructions for Running:
 * 1. Select the Physical Channel to correspond to where your
 * signal is input on the DAQ device.
 * 2. Enter the Minimum and Maximum Voltage Ranges.
 * Note: For better accuracy try to match the Input Ranges to the
 * expected voltage level of the measured signal.
 * 3. Select how many Samples to Acquire on Each Channel.
 * 4. Set the Rate of the Acquisiton.
 * Note: The Rate should be AT LEAST twice as fast as the maximum
 * frequency component of the signal being acquired.
 * 5. Select the Source and Edge of the Digital Reference Trigger
 * for the acquisition.
 *
 * Steps:
 * 1. Create a task.
 * 2. Create an analog input voltage channel.
 * 3. Define the parameters for an Internal Clock Source.
 * Additionally, define the sample mode to be Finite.
 * 4. Define the parameters for a Digital Edge Reference Trigger.
 * 5. Call the Start function to begin the acquisition.
 * 6. Use the Read function to retrieve the waveform. Set a timeout
 * so an error is returned if the samples are not returned in
 * the specified time limit.
 * 7. Call the Clear Task function to clear the Task.
 * 8. Display an error if any.
 *
 * I/O Connections Overview:
 * Make sure your signal input terminal matches the Physical
 * Channel I/O Control. Also, make sure your digital trigger
 * terminal matches the Trigger Source Control. For further
 * connection information, refer to your hardware reference manual.
 *
 * Recommended Use:
 * 1. Call Configure and Start functions.
 * 2. Call Read function.
 * 3. Call Stop function at the end.
 *
 *********************************************************************/
 #include "NIDAQmxBase.h"
 #include
 #define DAQmxErrChk(functionCall) { if( DAQmxFailed(error=(functionCall)) ) { goto Error; } }
 int main(int argc, char *argv[])
 {
 // Task parameters
 int32 error = 0;
 TaskHandle taskHandle = 0;
 char errBuff[2048]={'\0'};
 int32 i;
 // Channel parameters
 char chan[] = "Dev1/ai0";
 float64 min = -10.0;
 float64 max = 10.0;
 // Timing parameters
 char clockSource[] = "OnboardClock";
 uInt64 samplesPerChan = 1000;
 float64 sampleRate = 10000.0;
 // Triggering parameters
 char triggerSource[] = "/Dev1/PFI0";
 //uInt32 triggerSlope = DAQmx_Val_RisingSlope;
 uInt32 triggerSlope = DAQmx_Val_Rising;
 uInt32 triggerSamples = 100;
 // Data read parameters
 #define bufferSize (uInt32)1000
 float64 data[bufferSize];
 int32 pointsToRead = bufferSize;
 int32 pointsRead;
 float64 timeout = 10.0;
 DAQmxErrChk (DAQmxBaseCreateTask("",&taskHandle));
 DAQmxErrChk (DAQmxBaseCreateAIVoltageChan(taskHandle,chan,"",DAQmx_Val_Cfg_Default,min,max,DAQmx_Val_Volts,NULL));
 DAQmxErrChk (DAQmxBaseCfgSampClkTiming(taskHandle,clockSource,sampleRate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,samplesPerChan));
 DAQmxErrChk (DAQmxBaseCfgDigEdgeRefTrig(taskHandle,triggerSource,triggerSlope,triggerSamples));
 DAQmxErrChk (DAQmxBaseStartTask(taskHandle));
 DAQmxErrChk (DAQmxBaseReadAnalogF64(taskHandle,pointsToRead,timeout,DAQmx_Val_GroupByChannel,data,bufferSize,&pointsRead,NULL));
 printf ("Acquired %d samples\n", pointsRead);
 // Just print out the first 10 points
 for (i = 0; i < 10; ++i)
 printf ("data[%d] = %f\n", i, data[i]);
 Error:
 if( DAQmxFailed(error) )
 DAQmxBaseGetExtendedErrorInfo(errBuff,2048);
 if(taskHandle != 0) {
 DAQmxBaseStopTask (taskHandle);
 DAQmxBaseClearTask (taskHandle);
 }
 if( DAQmxFailed(error) )
 printf("DAQmxBase Error: %s\n",errBuff);
 return 0;
 }
 JoeFriedchicken
		
			JoeFriedchicken
		
		
		
		
		
		
		
		
	
			
			
    
	
		
		
		01-30-2009
	
		
		03:22 PM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 - last edited on 
    
	
		
		
		01-22-2024
	
		
		02:57 PM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 by 
				
		 migration-bot
		
			migration-bot
		
		
		
		
		
		
		
		
	
			
		
Digital reference triggers, while supported in hardware by the USB-6210, are not implemented in the DAQmx Base driver [1]. You can, however, use a digital start trigger since they are implemented in DAQmx Base.
If you need a digital reference trigger, then the best solution is to replicate a reference trigger in software. But since DAQmx Base isn't multi-threaded, reading from both the analog and digital tasks can't be done in parallel but in sequence. This limitation introduces a small discrepancy between the time when the digital level change has been detected and when the software would then mark the reference trigger in the analog data.
In addition, there is no way to exactly correlate the digital event to the analog data in software since the 6210 cannot hardware time the digital I/O, but can only perform static (software timed) reads and writes.
[1] NI-DAQmx Base readme
https://download.ni.com/support/softlib/multifunction_daq/nidaqmxbase/3.2/Linux/readme.txt
Joe Friedchicken
NI Configuration Based Software Get with your fellow OS users 
[ Linux ] [ macOS ]Principal Software Engineer :: Configuration Based Software 
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
 LenardV
		
			LenardV
		
		
		
		
		
		
		
		
	
			04-05-2020 09:49 AM
Dear All,
I have USB-6212 and I like to program it in Python 2.7. My goal is to use PFI0 as a fast sampling trigger at 160kHz and PFI1 as a low sampling trigger around 10Hz simultaneously: after every PF1 rising edge ca. 5000 sample should be gathered at the rising edges of PFI0.
I have no experience in NIDAQ programming in Python, so I follow step-by-step the Python and ANSI C examples (implementing them into Python). However I get stucked with a very simple problem:
I generate a train of alternating 10101010.. digital signal with ca. 2Hz on RedPitaya at 3.3V for High value for testing the digital inputs like PFI0 or PFI1.(see pp.5-6. here: http://staff.ltam.lu/feljc/electronics/redpitaya/RedPitayaScriptingSummary_1.pdf)
The signals are clearly recorded (see ai_input.png) using the analog input example: https://github.com/ni/nidaqmx-python/blob/master/nidaqmx_examples/every_n_samples_event.py
However I can't see anything on the digital inputs neither in NI MAX nor in the Python example: https://github.com/ni/nidaqmx-python/blob/master/nidaqmx_examples/di_sw_timed.py
Anyone has an idea what I am forgetting here?
Best,
Lenard
 @wadhesh
		
			@wadhesh
		
		
		
		
		
		
		
		
	
			07-11-2024 10:53 PM
Hi LenardV,
Did you solve the issue? I also have similar kind of problem. I am using PFI1 as laser trigger which at 5 KHz and PFI12 as Zaber controller trigger for the data acquisition using NI DAQ 6281. This device was working well and I was getting the digital outputs too. Recently, I encountered some error while running the LabVIEW program. Upon test, I found that the digital output PFI 1 is working but PFI12 is not measuring anything. It is supposed to measure the Zaber trigger at 5KHz. I have no idea where the problem lies.
If you have solved the issue, could you suggest me the solution please?
 zabercs
		
			zabercs
		
		
		
		
		
		
		
		
	
			07-16-2024 12:41 PM - edited 07-16-2024 12:42 PM
Hi @wadhesh
If you are still having an issue reading the digital output from the Zaber device, can you email more details of your device, trigger, and wiring at mike@zaber.com? The issue may be on the Zaber side.
Best regards,
Mike McDonald
Applications Engineering Team
Zaber Technologies
 @wadhesh
		
			@wadhesh
		
		
		
		
		
		
		
		
	
			07-17-2024 01:28 PM
Hi Mike,
Thank you for replying. I solved the issue.
Thank you.
Regards,
Awadhesh