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

[Failed] Integration of externally triggering a camera with generating a pulse train using DAQmx C API

$
0
0

I post my inquiry at this section again. It was originally posted at [Machine Vision] Section as linked below.

 

https://forums.ni.com/t5/Machine-Vision/Failed-Integration-of-externally-triggering-a-camera-with/td-p/4335356

 

I would like to make an integrated programming code of hardware-triggering a camera with generating a pulse train.

 

If anyone could address this issue or make a comment on this then, I would appreciate a lot.

 

Attached below is the snippet for this work.

 

Below are the hardware and software specifications that I am using now for this work.
---------------------------------------------------------------------------------------------------------------------------
DAQ board: NI USB-6363 (BNC)

Camera: IDS camera (Model: U3-38J1XLE-M-GL_Rev_1_1)

Camera feature: 'ReadOutStart' only surpported as a 'TriggerSelector' parameter

Camera pin: An external trigger input is supported only. There is no any flash light output.

Pin connection: The camera external trigger 'input' port was directly connected with the PFI12 (i.e., Counter Output 0's terminal) on the DAQ board via BNC to Alligator clip cable.

Programming language: Visual Studio 2017, MFC (Microsoft Foundation Class)
---------------------------------------------------------------------------------------------------------------------------

 

In detail, I have already checked that an externally-triggered camera MFC code alone could capture image quite well by using a sample code of 'VC_DigPulseTrain_Cont' at DAQmx C API. According to the pulse frequency that I adjusted in the 'VC_DigPulseTrain_Cont', the frame rate of a real time image was reflected well. However, Those codes are not yet integrated but separated at present.

In the snippet that I attached, I had tried to integrate the two codes together for making one MFC code. Therefore, I tried to use a synchronization object of 'CEvent' in order not to monopolize a CPU from a worker thread of 'AcquisitionWorker()' so that I expected to do a pulse generation seamlessly. However, the integrated code is not working. That is, any pulse train does not be shown on an oscilloscope and thus the camera can not capture an image any more.

 

In Labview, in my memory, the synchronization between a camera capture and a DAQmx trigger signal is carried out by correctly deploying all the configurations via a 'Merge Errors.vi' right before a 'while' loop. So, I tried to imitate the advanced synchronization Labview examples between devices.

 

Below is a representative snippet inserted in the attached.

// Start capture worker thread
m_threadAcquisition = AfxBeginThread(AcquisitionWorker, this);
g_EvCam_capture_ready.PulseEvent();
DAQmxStartTask(FTTaskHandle);

Kindest regards and many thanks in advance,

Headalma


Viewing all articles
Browse latest Browse all 654

Trending Articles



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