Please enable JavaScript to view this site.

IDS Software Suite 4.96.1

Navigation: C: Programming > Function descriptions > is_IO

Using pulse-width modulation

Scroll Previous Top Next More
Windows_Logo
Linux_Logo

USB 3.x

GigE

USB 3.x

GigE

Syntax

INT is_IO(HIDS hCam, UINT nCommand, void* pParam, UINT cbSizeOfParam)

Description

For pulse-width modulation you can use either the flash output or the additional digital outputs (GPIO) of some uEye models. For information on GPIO wiring, please refer to the D: Specifications chapter.

The pulse width modulation is supported by all GigE uEye cameras, USB 3 uEye cameras, and uEye SE USB 3.1 Gen 1 cameras. It is not supported by the UI-359xLE Rev. 1 and uEye LE USB 3.1 Gen 1.

The nCommand input parameter is used to select the function mode. The pParam input parameter depends on the selected function mode. If you select functions for setting or returning a value, pParam contains a pointer to a variable of the UINT type. The size of the memory area to which pParam refers is specified in the cbSizeOfParam input parameter.

Input parameters

hCam

Camera handle

pParam

Pointer to a function parameter, whose function depends on nCommand.

cbSizeOfParam

Size (in bytes) of the memory area to which pParam refers.

Contents of the IO_PWM_PARAMS structure

double

dblFrequency_Hz

Frequency of the pulse-width modulation (PWM)

1.0…10 000 Hz

double

dbl_DutyCycle

Duty cycle of the pulse-width modulation

0.0…1.0 (1.0 corresponds to 100 %)

Example 1

INT nRet = IS_SUCCESS;
 
// Get all GPIOs that can be used as flash output
UINT nGPIOs_Flash = 0;
INT nRet = is_IO(m_hCam, IS_IO_CMD_FLASH_GET_SUPPORTED_GPIOS,
                (void*)&nGPIOs_Flash, sizeof(nGPIOs_Flash));
 
// Get all GPIOs that can be used for the PWM
UINT nGPIOs_PWM = 0;
INT nRet = is_IO(m_hCam, IS_IO_CMD_PWM_GET_SUPPORTED_GPIOS,
                (void*)&nGPIOs_PWM, sizeof(nGPIOs_PWM));

Example 2

INT nRet = IS_SUCCESS;
 
// Set GPIO1 as PWM output
UINT nMode = IO_GPIO_1;
nRet = is_IO(m_hCam, IS_IO_CMD_PWM_SET_MODE,
            (void*)&nMode, sizeof(nMode));
 
// Set GPIO1, GPIO2 and the flash pin as PWM output
nMode = IO_GPIO_1 | IO_GPIO_2 | IS_FLASH_MODE_PWM;
nRet = is_IO(m_hCam, IS_IO_CMD_PWM_SET_MODE, (void*)&nMode, sizeof(nMode));
 
// Get the current PWM mode
nRet = is_IO(m_hCam, IS_IO_CMD_PWM_GET_MODE, (void*)&nMode, sizeof(nMode));

Example 3

INT nRet = IS_SUCCESS;
 
IO_PWM_PARAMS m_pwmParams;
 
// Get the minimum values of the PWM parameters
nRet = is_IO(m_hCam, IS_IO_CMD_PWM_GET_PARAMS_MIN,
            (void*)&m_pwmParams, sizeof(m_pwmParams));
if (nRet == IS_SUCCESS)
{
  double dblFrequencyMin = m_pwmParams.dblFrequency_Hz;
  double dblDutyCycleMin = m_pwmParams.dblDutyCycle;
}
 
// Get the maximum values of the PWM parameters
nRet = is_IO(m_hCam, IS_IO_CMD_PWM_GET_PARAMS_MAX,
            (void*)&m_pwmParams, sizeof(m_pwmParams));
if (nRet == IS_SUCCESS)
{
  double dblFrequencyMax = m_pwmParams.dblFrequency_Hz;
  double dblDutyCycleMax = m_pwmParams.dblDutyCycle;
}
 
// Get the increment of the PWM parameters
nRet = is_IO(m_hCam, IS_IO_CMD_PWM_GET_PARAMS_INC,
            (void*)&m_pwmParams, sizeof(m_pwmParams));
if (nRet == IS_SUCCESS)
{
  double dblFrequencyInc = m_pwmParams.dblFrequency_Hz;
  double dblDutyCycleInc = m_pwmParams.dblDutyCycle;
}
 
// Get the current values of the PWM parameters
nRet = is_IO(m_hCam, IS_IO_CMD_PWM_GET_PARAMS,
            (void*)&m_pwmParams, sizeof(m_pwmParams));
if (nRet == IS_SUCCESS)
{
  double dblFrequency = m_pwmParams.dblFrequency_Hz;
  double dblDutyCycle = m_pwmParams.dblDutyCycle;
}
 
// Set the current values of the PWM parameters (1 KHz, 50% duty cycle)
m_pwmParams.dblFrequency_Hz = 1000;
m_pwmParams.dblDutyCycle = 0.5;
nRet = is_IO(m_hCam, IS_IO_CMD_PWM_SET_PARAMS,
            (void*)&m_pwmParams, sizeof(m_pwmParams));

© 2022 IDS Imaging Development Systems GmbH