PDA

View Full Version : Can GPIO be controlled with the IC Imaging Control C Library?



dejav
January 7, 2016, 02:22:37
Can a camera's GPIO output be read and write using the IC Imaging Control C Library? I couldn't find any mention of it in the docs. I can read the GPIO of a camera if I use IC Capture -> Properties... -> Special -> GPIO.

Stefan Geissler
January 7, 2016, 11:10:46
Hello Dejav

Yes, the GP IO can be controlled from the TISGrabber.DLL. The "ansi.c" file contains sample code for doing this at line 1038:


void GPOut()
{
HGRABBER hGrabber = IC_ShowDeviceSelectionDialog(NULL);
printf("Strobe Property Sample\n");

printf("0\n");
IC_SetPropertyValue(hGrabber,"GPIO","GP Out", (int) 0);
IC_PropertyOnePush(hGrabber,"GPIO","Write");

printf("Press a key to continue\n");
_getch();

printf("1\n");
IC_SetPropertyValue(hGrabber,"GPIO","GP Out", (int) 1 );
IC_PropertyOnePush(hGrabber,"GPIO","Write");

printf("Press a key to continue\n");
_getch();

printf("0\n");
IC_SetPropertyValue(hGrabber,"GPIO","GP Out", (int) 0 );
IC_PropertyOnePush(hGrabber,"GPIO","Write");

printf("Press a key to continue\n");
_getch();

printf("1\n");
IC_SetPropertyValue(hGrabber,"GPIO","GP Out", (int) 1 );
IC_PropertyOnePush(hGrabber,"GPIO","Write");

printf("Press a key to end\n");
_getch();

IC_StopLive(hGrabber);
IC_ReleaseGrabber(&hGrabber);
IC_CloseLibrary();
}


That is "GP Out", means the output. The input is "GP In" and the reading is done with "Read"


int Value;
IC_PropertyOnePush(hGrabber,"GPIO","Read");
IC_GetPropertyValue(hGrabber,"GPIO","GP In",&Value);

dejav
January 7, 2016, 23:22:00
Great, thanks Stefan.