UC-1.1 (USB Model) Initialization Code Migration Guide
All of the sample programs in this documentation set are written assuming the GbE-2 (Ethernet model), but by rewriting just a few lines of the camera initialization and open handling, the exact same image acquisition and decoding processing can also run on the UC-1.1 (USB model).
Changes to the Connection Handling
Section titled “Changes to the Connection Handling”Because the GbE-2 and UC-1.1 use different connection interfaces (Ethernet / USB), the parameters specified in the device search and open functions differ.
| Item | GbE-2 (Ethernet model) | UC-1.1 (USB model) |
|---|---|---|
| Search flag | PUC_DETECT_TARGET_GBE2 |
PUC_DETECT_TARGET_UC1 |
| Search API | PUC_DetectDevice2 |
PUC_DetectDevice2 (or PUC_DetectDevice) |
| Open API | PUC_OpenDevice2 |
PUC_OpenDevice2 (or PUC_OpenDevice) |
Code Comparison
Section titled “Code Comparison”Connection code for GbE-2 (before)
Section titled “Connection code for GbE-2 (before)”// 1. Search, targeting GbE-2 devicesPUC_DETECT_FILTER filter = { 0 };filter.nDeviceTypeFlags = PUC_DETECT_TARGET_GBE2; // Specify GbE-2
PUC_DETECT_INFO detectInfo = { 0 };PUCRESULT ret = PUC_DetectDevice2(&filter, &detectInfo);if (ret != PUC_SUCCEEDED || detectInfo.nDeviceCount == 0) { printf("Error: No GbE-2 camera was found.\n"); return EXIT_FAILURE;}
// 2. Open the first detected devicePUC_HANDLE hDevice = NULL;ret = PUC_OpenDevice2(0, &hDevice);Connection code for UC-1.1 (after)
Section titled “Connection code for UC-1.1 (after)”// 1. Search, targeting UC-1.1 devicesPUC_DETECT_FILTER filter = { 0 };filter.nDeviceTypeFlags = PUC_DETECT_TARGET_UC1; // Specify UC-1.1 (USB)
PUC_DETECT_INFO detectInfo = { 0 };PUCRESULT ret = PUC_DetectDevice2(&filter, &detectInfo);if (ret != PUC_SUCCEEDED || detectInfo.nDeviceCount == 0) { printf("Error: No UC-1.1 camera was found.\n"); return EXIT_FAILURE;}
// 2. Open the first detected devicePUC_HANDLE hDevice = NULL;ret = PUC_OpenDevice2(0, &hDevice);Sample Program for UC-1.1 (HelloWorld)
Section titled “Sample Program for UC-1.1 (HelloWorld)”This is a minimal program covering the full flow — from initialization, connection, and information retrieval, to closing the device — written for the UC-1.1.
-
Write the source code
#include <stdio.h>#include <stdlib.h>#include <PUCLIB.h> // Load the PUCLIB headerint main() {printf("Initializing INFINICAM UC-1.1...\n");// 1. Initialize the SDKPUCRESULT ret = PUC_Initialize();if (ret != PUC_SUCCEEDED) {printf("Error: Failed to initialize the SDK. ErrorCode: %d\n", ret);return EXIT_FAILURE;}// 2. Search for a UC-1.1 device connected via USBPUC_DETECT_FILTER filter = { 0 };filter.nDeviceTypeFlags = PUC_DETECT_TARGET_UC1; // Specify UC-1.1PUC_DETECT_INFO detectInfo = { 0 };ret = PUC_DetectDevice2(&filter, &detectInfo);if (ret != PUC_SUCCEEDED || detectInfo.nDeviceCount == 0) {printf("Error: No UC-1.1 camera was found. ErrorCode: %d\n", ret);return EXIT_FAILURE;}printf("Detected a UC-1.1 camera. (Devices found: %d)\n", detectInfo.nDeviceCount);// 3. Open the first detected devicePUC_HANDLE hDevice = NULL;ret = PUC_OpenDevice2(0, &hDevice);if (ret != PUC_SUCCEEDED) {printf("Error: Failed to open the device. ErrorCode: %d\n", ret);return EXIT_FAILURE;}printf("SUCCESS: The UC-1.1 was opened successfully!\n");// 4. Example of retrieving camera informationUINT64 serialNo = 0;if (PUC_GetSerialNo(hDevice, &serialNo) == PUC_SUCCEEDED) {printf("Serial number: %llu\n", serialNo);}UINT32 width = 0, height = 0;if (PUC_GetResolution(hDevice, &width, &height) == PUC_SUCCEEDED) {printf("Resolution: %u x %u pixels\n", width, height);}// 5. Close the devicePUC_CloseDevice(hDevice);return EXIT_SUCCESS;} -
Notes for running
- Connecting to a USB 3.1 Gen1 (USB 3.0) port: To ensure sufficient data transfer bandwidth, connect directly to a USB 3.0 or higher Type-C port on the PC (the camera will not operate correctly on a USB 2.0 port).
- Specifying a 64-bit (x64) build: Make sure the Visual Studio build configuration is set to
x64.
