background image

 

 

 

 

17/33 

Sentech GigE Vision Camera StGigE SDK 
Sample Guide Rev.1.00 

 

2. The sample programs for the specific usages 

 

2.1 Software trigger 

 

2.1.1 Software trigger with PLC function 

This sample shows how to generate the software trigger signal with the PLC function. 

 

To generate the software trigger signal: 

Input the signal from the PLC_ctrl0 to Q9 through I5. 
Output the signal, which is generated by the Pulse Generator 0 at the rising edge of the input signal, to the 
PG0_out(Timer 1 Out). 
The trigger signal from the pg0_out through I4 through Q4 to the camera control FPGA. 

 

Please check with iPORT.Reference.Programmable_Logic_Controller.pdf for more details of the PLC. 

 

A. Connects the camera, obtains the PvDevice then sets PvStream and PvPipeline. 

Please check the sample program for GEVPlayerSample, PvSimpleUISample or PvstreamSample to make the 
applications. 

 

B. Sets the route for the PLC. 
// Function for set up the PLC route for the software trigger. 

BOOL SetupPLCRoute( PvDevice *pDevice ) 

    PvGenBoolean*   lPvGenBoolean; 
    BOOL bReval; 

 

    //Q4 = I7 
    bReval = SetupLUT( pDevice, 4, "PLC_I7","Or","Zero","Or","Zero","Or","Zero" ); 
    if( !bReval ) return FALSE; 
    //Q9 = I5 
    bReval = SetupLUT( pDevice, 9, "PLC_I5","Or","Zero","Or","Zero","Or","Zero" ); 
    if( !bReval ) return FALSE; 

 

    bReval = SetupSRB( pDevice, 5, "PLC_ctrl0" ); 
    if( !bReval ) return FALSE; 
    bReval = SetupSRB( pDevice, 7, "Timer1Out" ); 
    if( !bReval ) return FALSE; 

 

    return TRUE; 

 

// Function for sets the LookupTable 

BOOL SetupLUT( PvDevice *pDevice, int iQ, 
      PCHAR pText1,PCHAR pText2,PCHAR pText3,PCHAR pText4,PCHAR pText5,PCHAR pText6,PCHAR pText7 
      ) 

    // *********************************************** // 
    // Route PLC_Ixx to Qxx                            // 
    // *********************************************** // 

Содержание GigE Vision

Страница 1: ...1 33 Sentech GigE Vision Camera StGigE SDK Sample Guide Rev 1 00 Sentech GigE Vision Camera StGigE SDK Sample Guide Sensor Technology Co Ltd ...

Страница 2: ...e 10 1 12 PvPlcAndGevEvents 11 1 13 PvPlcDelayerSample 12 1 14 PvPlcRescalerSample 12 1 15 PvRecoverySample 13 1 16 PvRGBFilterSample 13 1 17 PvSimpleUISample 14 1 18 PvStreamSample 14 1 19 NetCommandSample 15 1 20 StGEViewerSample 15 1 21 StGEMultiCameraSample 15 1 22 StGEOpenCVFacesDetectSample 16 1 23 StGEOpenCVSharpSample 16 2 The sample programs for the specific usages 17 2 1 Software trigger...

Страница 3: ... This sample is the source code for the StGigE Player application StGigE Player application is used to connect and configure the GigE Vision camera 1 Introduction This sample help to understand how to use StGigE SDK 2 Prerequisite Please check the StGigE Player application before use this sample code It is necessary to understand and have the knowledge about C and Microsoft MFC foundation class 3 ...

Страница 4: ... Images under Tools in the menu 3 11 LoadingThread cpp The source code file for the thread which is created the class of the asynchronous load from the pvcfg file and the connection procedure and pass the message to the ProgressDlg Please check ProgressDlg cpp 3 12 LogBuffer cpp The source code file for use the log events for Event Monitor dialog Please check EventMonitorDlg cpp 3 13 ParameterInfo...

Страница 5: ...on 1 3 PvBufferWriterSample This sample shows how to use the PvBuffer and the PvBufferWriter classes 1 Introduction This sample shows how to Creates and allocates the buffer and obtains the image with the PvBuffer class Saves the buffer data to the bitmap format file with the PvBufferWriter class 2 Prerequisite When use this sample The camera has to connect to the NIC which is installed either the...

Страница 6: ...ns excluding the image streaming and display thread are in the PvCamHeadSerialComLogSampleDlg 2 Prerequisite When use this sample The camera has to connect to the NIC which is installed either the eBUS Universal Pro or the Optimal driver before use this sample 3 Descriptions of the files 3 1 PvCamHeadSerialComLogSampleDlg cpp The source code file for the main application dialog The most of the eve...

Страница 7: ...this sample 3 Descriptions of the files 3 1 PvConfigurationReaderSample cpp The source code file for the sample program of how to use the PvConfigurationReader and the PvConfigurationWriter classes Please check the comments in this source code for the information which is how to use these classes 1 6 PvCustomPipelineSample This sample shows how to use the PvPipeline class 1 Introduction This sampl...

Страница 8: ... PvGenParameterArray class to control the settings of the camera 1 Introduction This sample shows how to Obtains the PC communication related settings with the PvGenParameterArray class Obtains the settings of the camera with the PvGenParameterArray class Obtains the image stream control settings with the PvGenParameterArray class Obtains and sets the PvGenParameter value with the PvGenParameter c...

Страница 9: ... source code file for the sample program of how to use the PvDevice class Please check the comments in this source code for the information which is how to use this class 1 10 PvMulticastSlaveSample This sample shows how to use the PvPipeline class to use the multicast slave Please connects the camera as the multicast master with the multicasting master sample PvMulticastSample before use this sam...

Страница 10: ...the image from the camera Statistics the data of obtain the image Stops the streaming 2 Prerequisite When use this sample The camera has to connect to the NIC which is installed either the eBUS Universal Pro or the Optimal driver before use this sample 3 Descriptions of the files 3 1 PvPipelineSample cpp The source code file for the sample program of how to use the PvPipeline class Please check th...

Страница 11: ...if PLC_I4 PLC_ctrl1 3 2 PLC LUT setup PLC_Q7 I0 PLC_Interrupt PLC_Q17 I0 Counter increament signal PLC_Q3 I4 Counter reset 3 3 Enable PLC_Interrupt_FIFO0_Q7 and register PLC_Interrupt_FIFI0_IRQ_mask parameter to the PvGenEventSink Updates this parameter when the PLC interrupt happens After update the PvGenEventSink OnParameterUpdate callback function call 3 4 Setup as the rising edge of PLC_Q17 si...

Страница 12: ...ore use this sample 3 Descriptions of the files 3 1 PvPlcDelayerSample cpp The source code file for emits 23 Hz signal wave pulse with Timer Pulse Generator 0 Delayer makes the delay for the input signal Please check the comments in this source code for the information which is how to use this class NOTE This sample is based on the Demonstrating the Rescaler tutorial in the Programmable Logic Cont...

Страница 13: ...ion that obtains the image Please check the comments in this source code for the information which is how to use these classes Sentech GigE cameras do NOT have the DeviceReset function in this 1 16 PvRGBFilterSample This sample shows how to use the PVBufferConverter and the PvFilterRGB to convert the image This sample shows how to use the PvBufferWrite class to save the image into bitmap file 1 In...

Страница 14: ...e The camera has to connect to the NIC which is installed either the eBUS Universal Pro or the Optimal driver before use this sample 3 Descriptions of the files 3 1 PvSimpleUISample cpp The source code file for the create UI application 1 18 PvStreamSample This sample shows how to connects the camera obtains and displays the image with the PvStream class 1 Introduction This sample shows how to Con...

Страница 15: ...stand how to setup the camera with the GenICam command This sample help to understand how to setup the camera with the PVSerialPortIPEngine class 2 Prerequisite When use this sample Please use the Visual Studio 2008 VS9 Required to understand the C and the Microsoft MFC Please build to make the application to understand the operation 1 21 StGEMultiCameraSample This sample shows how to connect and ...

Страница 16: ...stand the C and the Microsoft MFC Please build to make the application to understand the operation This sample made with OpenCV2 1 0 1 23 StGEOpenCVSharpSample This sample shows how to make the un sharp mask sample program with OpenCV Please download OpenCV than make the library to use it 1 Introduction This sample help to understand how to connects the camera and obtains the image This sample hel...

Страница 17: ... of the PLC A Connects the camera obtains the PvDevice then sets PvStream and PvPipeline Please check the sample program for GEVPlayerSample PvSimpleUISample or PvstreamSample to make the applications B Sets the route for the PLC Function for set up the PLC route for the software trigger BOOL SetupPLCRoute PvDevice pDevice PvGenBoolean lPvGenBoolean BOOL bReval Q4 I7 bReval SetupLUT pDevice 4 PLC_...

Страница 18: ...xt3 if lResult IsOK return FALSE sprintf PLCText PLC_Q d_Operator1 iQ lPvGenEnum dynamic_cast PvGenEnum pDevice GetGenParameters Get PLCText if lPvGenEnum NULL return FALSE lResult lPvGenEnum SetValue pText4 if lResult IsOK return FALSE sprintf PLCText PLC_Q d_Variable2 iQ lPvGenEnum dynamic_cast PvGenEnum pDevice GetGenParameters Get PLCText if lPvGenEnum NULL return FALSE lResult lPvGenEnum SetV...

Страница 19: ... Low status of the pulse bTrgMode Trigger mode True Continuously False Single pulse pulseScale Unit for the pulse Sets the 1 for 30 nseconds sets for 10 000 for 30 useconds BOOL SetPalseGenerator int index PvDevice pDevice int durationOfHigh int durationOfLow BOOL bTrgMode int pulseScale char PLCText 64 PvGenEnum lPvGenEnum PvGenInteger lPvGenInteger PvResult lResult sprintf PLCText TimerSelector ...

Страница 20: ...L return FALSE lResult lPvGenEnum SetValue bTrgMode if lResult IsOK return FALSE return TRUE D Sets the operation mode to the trigger mode Sets the operation mode bTriggerMode Operation mode True Trigger mode False Free run mode BOOL SetTriggerMode PvDevice pDevice BOOL bTriggerMode PvResult lResult PvGenEnum PvGenEnum dynamic_cast PvGenEnum pDevice GetGenParameters Get TriggerMode if lPvGenEnum N...

Страница 21: ...PvGenEnum dynamic_cast PvGenEnum pDevice GetGenParameters Get TriggerSoftwareSource if lPvGenEnum NULL return FALSE PvResult lResult lPvGenEnum SetValue iTriggerSoftwareSource return BOOL lResult IsOK H Input the trigger 1mseconds pulse input to the PLC_ctrl0 BOOL OneShotTrigger PvDevice pDeivce BOOL bResult bResult SetControlBit pDeivce 0 true if bResult return FALSE Sleep 1 1mS bResult SetContro...

Страница 22: ...PvGenEnum NULL return FALSE if bTriggerMode lResult lPvGenEnum SetValue On else lResult lPvGenEnum SetValue Off return BOOL lResult IsOK C Sets the exposure mode Sets the exposure mode iExposureMode 0 Timed 1 TriggerWidth BOOL SetExposureMode PvDevice pDevice int iExposureMode PvGenEnum lPvGenEnum dynamic_cast PvGenEnum pDevice GetGenParameters Get ExposureMode if lPvGenEnum NULL return FALSE PvRe...

Страница 23: ...ftwareSource 0 PLC 1 UserFPGA 2 Command BOOL SetTriggerSoftwareSource PvDevice pDevice int iTriggerSoftwareSource PvGenEnum lPvGenEnum dynamic_cast PvGenEnum pDevice GetGenParameters Get TriggerSoftwareSource if lPvGenEnum NULL return FALSE PvResult lResult lPvGenEnum SetValue iTriggerSoftwareSource return BOOL lResult IsOK G Input the trigger BOOL SetTriggerSoftware PvDevice pDevice PvGenCommand ...

Страница 24: ...ionTimeout 2000 lResult lSystem Find if lResult IsOK printf PvSystem Find Error s n lResult GetCodeString else PvUInt32 lInterfaceCount lSystem GetInterfaceCount for PvUInt32 x 0 x lInterfaceCount x get pointer to each of interface PvInterface lInterface lSystem GetInterface x printf Interface i MAC Address s IP Address s Subnet Mask s n x lInterface GetMACAddress GetUnicode lInterface GetIPAddres...

Страница 25: ... 255 0 Changes to the specified Subnet Mask lGateway 0 0 0 0 Changes to the specified Default Gateway Address BOOL ChangeDeviceInformation PvDeviceInfo lDeviceInfo PvString lIPAddress PvString lSubnetmask PvString lGateway PvDevice lDevice PvResult lResult lDevice SetIPConfiguration lDeviceInfo GetMACAddress lIPAddress lSubnetmask lGateway return BOOL lResult IsOK ...

Страница 26: ...dynamic_cast PvGenInteger lGenDevice Get GevCurrentIPAddress if lPersistentIPBoolean return FALSE PvGenInteger lSubnetMaskParam dynamic_cast PvGenInteger lGenDevice Get GevCurrentSubnetMask if lSubnetMaskParam return FALSE PvGenInteger lGatewayParam dynamic_cast PvGenInteger lGenDevice Get GevCurrentDefaultGateway if lSubnetMaskParam return FALSE lResult lIPAddressParam GetValue lIPAddress if lRes...

Страница 27: ...27 33 Sentech GigE Vision Camera StGigE SDK Sample Guide Rev 1 00 lResult lFlushGatewayParam SetValue lGateway if lResult IsFailure return FALSE return TRUE ...

Страница 28: ...e printf d ParameterName s n i aName GetAscii Description p_pvPara GetDescription lStr printf Description s n lStr GetAscii Category p_pvPara GetCategory lStr printf Category s n lStr GetAscii Visibility p_pvPara GetVisibility lVisibility if lVisibility 0 lStr Beginner else if lVisibility 1 lStr Expert else if lVisibility 2 lStr Guru else lStr Invisible printf Visibility s n lStr GetAscii Type PvG...

Страница 29: ...tryCount j const PvGenEnumEntry lEntry NULL lGenEnum GetEntryByIndex j lEntry lEntry GetName strValue printf Entry d s n j strValue GetAscii else if aType PvGenTypeBoolean 2 PvGenBoolean lGenBoolean dynamic_cast PvGenBoolean p_pvPara lResult lGenBoolean GetValue bValue if lResult IsOK printf Value d n bValue else if aType PvGenTypeString 3 PvGenString lGenString dynamic_cast PvGenString p_pvPara l...

Страница 30: ...30 33 Sentech GigE Vision Camera StGigE SDK Sample Guide Rev 1 00 return TRUE ...

Страница 31: ...lse lResult pPort Open pDevice PvIPEngineSerial1 return lResult IsOK SerialPort Close BOOL SerialPortClose PvSerialPortIPEngine pPort BOOL bReval TRUE if pPort IsOpened PvResult lResult pPort Close bReval lResult IsOK return bReval Data Send and Recieve BOOL SerialDataSendRev PvSerialPortIPEngine pPort PBYTE pbyteSend WORD wSendsize PBYTE pbyteRev WORD wRevsize PWORD pReadsize PvUInt32 aBytesWritt...

Страница 32: ...eval return FALSE BYTE byteSend 0x02 0x00 0x30 0x01 0x00 0x03 printf SendData for int i 0 i sizeof byteSend i printf 02X byteSend i printf n n BYTE byteRcv 4 WORD wReadSize 0 bReval SerialDataSendRev lSerialPort byteSend 0 sizeof byteSend byteRcv 0 sizeof byteRcv wReadSize if bReval printf RcvData for int i 0 i wReadSize i printf 02X byteRcv i printf n n SerialPortClose lSerialPort return bReval ...

Страница 33: ...ide Rev 1 00 Revision History Rev Date Changes Note 2 00 2012 11 05 New document Sensor Technology Co Ltd 7F Harada center building 9 17 Naka cho 4 chome Atsugi city Kanagawa 243 0018 Japan TEL 81 46 295 7061 FAX 81 46 295 7066 URL http www sentech co jp ...

Отзывы: