PDA

View Full Version : Capture the external trigger signal in my application for camera model DFK 33G445



vivek
January 27, 2016, 11:17:35
Hi all,

I am using DFK 33G445 camera model.I am giving external trigger signal in Line2.I want to capture the line2 signal in my application.Based on the signal in line2, I will decide whether the camera is live or not(i.e., if trigger signal value in Line2 is 1,camera is made live.otherwise trigger signal value is 0 and camera is not in live mode). Please help me in this regard to solve the issue.You can send me sample code in c++.

Thanks and Regards
vivek

Stefan Geissler
January 27, 2016, 12:58:16
You must check the GPIn property.
Declare two variables in your class:


DShowLib::tIVCDRangePropertyPtr m_pInput;
DShowLib::tIVCDButtonPropertyPtr m_pInputRead;




///////////////////////////////////////////////////////////////////////////
// This function queries the input properties. There are two of them,
// because one holds the value, the other one reads the value.
// The function returns true, if the input is supported by the current
// camera and the properties have been querried successfully.
//
// This function must be called every time, a new device has been opened.
bool MyClass::GetGPInput()
{
bool bResult = false;
if( m_cGrabber.isDevValid() )
{
tIVCDPropertyItemsPtr pItems = m_cGrabber.getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_GPIO, VCDElement_GPIOIn ,m_pInput);
if( m_pInput != NULL )
{
pItems->findInterfacePtr(VCDID_GPIO, VCDElement_GPIORead ,m_pInputRead);
if( m_pInputRead != NULL )
{
bResult = true;
}
}
}

return bResult;
}


Poll the input in a timer event handler


void MyClass::OnTimer(UINT_PTR nIDEvent)
{
long lInputState = 0;
KillTimer(nIDEvent);
if( m_cGrabber.isDevValid() )
{
if( m_pInputRead != NULL )
{
m_pInputRead->push(); // Get the current value from the device
m_pInput->get_Value(&lInputState); // Now we read the value

if( lInputState == 0 )
m_cGrabber.startLive();
else
m_cGrabber.stopLive();
}
}

SetTimer(nIDEvent,100,NULL);
CDialog::OnTimer(nIDEvent);
}


The trigger and GPin share the same pins 2 and 3. The code was copied from a dialog bases application doing something similar you do.

vivek
February 2, 2016, 19:45:26
Thank you stefan for your reply.
Can you please send me the code to write the GPOutput()

Stefan Geissler
February 3, 2016, 13:16:49
Hello

You may check the "DigitalIO" sample in the
c:\Users\<account name here>\Documents\IC Imaging Control 3.4\samples\vc10\DigitalIO\

directory.