Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog Trigger Input - PCI 6010

Hi everyone,

 

I have a PCI-6010. I'm programming in VC++ and DAQmx.

It seems to be a simple task, but i cannot seem to accomplish it by myself.

I would like to bring in an analog trigger signal and count every rising edge of this signal. 

Does any one have already made something similar? 

 

Hope someone can help,

 

Thanks a lot,

 

João Rodrigues.

0 Kudos
Message 1 of 5
(5,559 Views)

Hello JoãoRodrigues,

 

Have you already seen the DAQmx exemples ? 

You can find this exemples here :  Start Menu » Programs » National Instruments » NI DAQmx » Text-Based Code Support » ANSI C Examples

 

Or you can search exemple in the community :

http://www.ni.com/examples/f/

 

I found an exemple wich could help you :

http://www.ni.com/example/25908/en/

 

Have a good day 

 

Eloise
NI France

0 Kudos
Message 2 of 5
(5,542 Views)

Hello Eloise,

 

Thank you very much for your reply.

Yes, I have looked at some DAQmx examples, but none of them seems to explain how to accomplish my purpose. I will explain you what i'm trying to accomplish. It may be easier that way.

 

I have to synchronize the movement of a galvanometer with the acquisition of light's intensity reflected from the galvanometer's mirror. I'm using independent boards to control the acquisition and the galvanometer's movement.

For acquisition, i'm using a 400 MSPS board, and for galvanometer's movement the PCI-6010 from NI. 
The thing is, the acquisition is started by an analogue trigger signal generated from a light source. This signal has a frequency of 100 kHz, so, every 10 microsseconds, i'm acquiring N samples of light's intensity. 

The acquisition board enable the possibility of acquiring in framed mode, so I'm acquiring a packet with 512 frames (512 trigger pulses). 

 

My purpose is to generate a waveform every time I start a new framed acquisition, which would necessarly require counting the number of trigger pulses from the light source's analogue trigger.

 

Do you think it would be possible to input the analogue trigger into the PCI-6010 board, to count 512 pulses and then trigger the analogue output task?

 

I'm very sorry to waste your time. 

Thank you very much for your help.

 

Best regards.

 

João Rodrigues.

 

 

0 Kudos
Message 3 of 5
(5,513 Views)

Hello Eloise,

 

I have made some research and i was wondering if I can input my 2V analogue trigger in the PFI0 channel, i just want to use it as a trigger to ouput a waveform.

The basic code would be like:

 

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

//Create task  and output channel
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandle,"Dev1/ao0","",-0.5,0.5,DAQmx_Val_Volts,NULL));

 

//configure sampling clock and trigger channel
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",1000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000)); 

DAQmxErrChk (DAQmxCfgDigEdgeRefTrig(taskHandle,"/Dev1/PFI0",DAQmx_Val_Rising,100));

 

//start task

DAQmxErrChk (DAQmxStartTask(taskHandle));

 

//generate waveform

DAQmxErrChk (DAQmxWriteAnalogF64(taskHandle,1000,0,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL)));

 

//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

In the PCI - 6010 specifications, it is said that the PFI0 channel is a digital channel. Since my signal is analogue, is it correct to input it there? 
If "no", would it be more appropriate to use this piece of code instead?

 

//Create task  and output channel
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandle,"Dev1/ao0","",-0.5,0.5,DAQmx_Val_Volts,NULL));

 

//configure sampling clock and trigger channel
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",1000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000)); 

DAQmxErrChk (DAQmxCfgAnlgEdgeStartTrig(taskHandle,"Dev1/ai0",DAQmx_Val_Rising,1.0));

DAQmxErrChk (DAQmxSetAnlgEdgeStartTrigHyst(taskHandle, 0.1));

 

//start task

DAQmxErrChk (DAQmxStartTask(taskHandle));

 

//generate waveform

DAQmxErrChk (DAQmxWriteAnalogF64(taskHandle,1000,0,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL)));

 

//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

What is your opinion about that?

 

Thank you for your help.

 

Best regards,

 

João Rodrigues.

0 Kudos
Message 4 of 5
(5,479 Views)

Hello Eloise,

 

I have tried to implement the first piece of code that i have shown you in the past comment, but it seems to be a problem.

 

Using DAQmxErrorCheck i receive the following error when it reached the sentence "DAQmxCfgDigEdgeStartTrig":

-> "Specified property is not supported by the device or is not aaplicable to the task.
     Property: DAQmx_StartTrig_Type"
The task reffered is called "GalvoX" and is related to an analogue output channel.

 

Then, i tried to use a task related to an analogue input channel, and the code just work fine.

 

Could you tell me if this board is not able to support a trigger to generate an analogue output waveform?

 

Thank you for your help.

 

João Rodrigues.

 

0 Kudos
Message 5 of 5
(5,456 Views)