CCAux  2.17.0.0
CCAux API reference
Functions
CfgIn functions

Functions

EXTERN_C CCAUXDLL_API CFGINHANDLE CCAUXDLL_CALLING_CONV GetCfgIn (void)
 
EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV CfgIn_release (CFGINHANDLE)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CfgIn_setCfgInMode (CFGINHANDLE, uint8_t channel, CfgInModeEnum set_mode)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CfgIn_getCfgInMode (CFGINHANDLE, uint8_t channel, CfgInModeEnum *get_mode)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CfgIn_getValue (CFGINHANDLE, uint8_t channel, uint16_t *sample_value)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CfgIn_getPwmValue (CFGINHANDLE, uint8_t channel, float32_t *frequency, uint8_t *duty_cycle)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CfgIn_getFrequencyValue (CFGINHANDLE, uint8_t channel, float32_t *frequency)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CfgIn_getMinFrequencyThreshold (CFGINHANDLE, uint8_t channel, float32_t *frequency)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CfgIn_setMinFrequencyThreshold (CFGINHANDLE, uint8_t channel, float32_t frequency)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CfgIn_setFrequencyFilterLevel (CFGINHANDLE, uint8_t level)
 

Detailed Description

Functions in the CfgIn class

Function Documentation

◆ CfgIn_getCfgInMode()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::CfgIn_getCfgInMode ( CFGINHANDLE  ,
uint8_t  channel,
CfgInModeEnum get_mode 
)

Get Configurable Input mode

Supported Platform(s): VC, VA, VS, VI2

Parameters
channelWhich configurable input channel to use, 1-2 (VC), 1-8 (VA), 1 (VS) or 1-4 (VI2) corresponding to physical input channel
get_modeStorage container for retreived mode Configurable input can be set to different measurement modes, this reads the setting back
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

err = CfgIn_getCfgInMode(pCfgIn, channel, &get_mode);
if (err != ERR_SUCCESS)
{
cout << "CfgIn_getCfgInMode: " << GetErrorStringA(err) << std::endl;
}
else
{
switch(get_mode)
{
case CFGIN_NOT_IN_USE: cout << "CfgIn_getCfgInMode (" << (int)channel << "): CFGIN_NOT_IN_USE" << std::endl; break;
case CFGIN_HI_SWITCH: cout << "CfgIn_getCfgInMode (" << (int)channel << "): CFGIN_HI_SWITCH" << std::endl; break;
case CFGIN_LOW_SWITCH: cout << "CfgIn_getCfgInMode (" << (int)channel << "): CFGIN_LOW_SWITCH" << std::endl; break;
case CFGIN_VOLTAGE_2V5: cout << "CfgIn_getCfgInMode (" << (int)channel << "): CFGIN_VOLTAGE_2V5" << std::endl; break;
case CFGIN_VOLTAGE_5V: cout << "CfgIn_getCfgInMode (" << (int)channel << "): CFGIN_VOLTAGE_5V" << std::endl; break;
case CFGIN_RESISTANCE: cout << "CfgIn_getCfgInMode (" << (int)channel << "): CFGIN_RESISTANCE" << std::endl; break;
case CFGIN_FREQ_FLOATING: cout << "CfgIn_getCfgInMode (" << (int)channel << "): CFGIN_FREQ_FLOATING" << std::endl; break;
case CFGIN_FREQ_PULLUP: cout << "CfgIn_getCfgInMode (" << (int)channel << "): CFGIN_FREQ_PULLUP" << std::endl; break;
case CFGIN_FREQ_PULLDOWN: cout << "CfgIn_getCfgInMode (" << (int)channel << "): CFGIN_FREQ_PULLDOWN" << std::endl; break;
default: cout << "CfgIn_getCfgInMode (" << (int)channel << "): Unknown mode" << std::endl; break;
}
}

◆ CfgIn_getFrequencyValue()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::CfgIn_getFrequencyValue ( CFGINHANDLE  ,
uint8_t  channel,
float32_t frequency 
)

Read the sampled frequency value from configurable input, when in frequency mode:

VA: For ports 1-4, time base is 72 MHz ± 100 ppm (more accurate) For ports 5-8, time base is 60 kHz ± 100 ppm (less accurate) Input range is 0 Hz – 15 kHz. See technical manual for more details.

VA: For all ports 1-8: CFGIN_FREQ_PD_5V - sample_value in Hz CFGIN_FREQ_PD_10V - sample_value in Hz CFGIN_FREQ_PD_32V - sample_value in Hz CFGIN_FREQ_F_5V - sample_value in Hz CFGIN_FREQ_F_10V - sample_value in Hz CFGIN_FREQ_F_32V - sample_value in Hz

VA: For ports 5-8 only: CFGIN_FREQ_PU_5V - sample_value in Hz CFGIN_FREQ_PU_10V - sample_value in Hz CFGIN_FREQ_PU_32V - sample_value in Hz

VS: Port 1 only - sample_value in Hz

VI2: For ports 1-4 time base is 48 Mz ±100 ppm Input range is 0.1 Hz - 50 kHz. See technical manual for more details.

VI2: For all ports 1-4: CFGIN_FREQ_FLOATING - sample_value in Hz CFGIN_FREQ_PULLUP - sample_value in Hz CFGIN_FREQ_PULLDOWN - sample_value in Hz

Supported Platform(s): VA, VS, VI2

Parameters
channelWhich configurable input channel to use, 1 through 8, corresponding to physical input channel
frequencyRead signal frequency in Hz; signal resolution and range depending on mode and port
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

◆ CfgIn_getMinFrequencyThreshold()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::CfgIn_getMinFrequencyThreshold ( CFGINHANDLE  ,
uint8_t  channel,
float32_t frequency 
)

Read the configured minimum frequency threshold for configurable input, when in frequency measurement mode (CFGIN_FREQ_FLOATING, CFGIN_FREQ_PULLUP, CFGIN_FREQ_PULLDOWN for VC and VI2, and CFGIN_FREQ_PD_5V, CFGIN_FREQ_PD_10V, CFGIN_FREQ_PD_32V, CFGIN_FREQ_F_5V, CFGIN_FREQ_F_10V, CFGIN_FREQ_F_32V, CFGIN_FREQ_PU_5V, CFGIN_FREQ_PU_10V, CFGIN_FREQ_PU_32V for VA). The frequency threshold is set to 1Hz at device start-up. Use the frequency threshold to set up how fast to detect
a frequency change or a static signal. If you know the frequency range of the measured signal - set the threshold slightly lower than this. That way, a change from pulses to a static signal is detected as fast as possible. If the frequency threshold is set to e.g. 0.1Hz, it can take up to 10 seconds before a change in frequency is detected - also depending on the actual frequency of the signal. For VC, when the measured signal is slower than the frequency threshold, CfgIn_getPwmValue will return frequency 0Hz, duty cycle 0 or 100%. For VA, when the measured signal is slower than the frequency threshold, CfgIn_getFrequencyValue will return frequency 0 Hz. For VS, this function/setting only applies for input channel 1.

Supported Platform(s): VC, VA, VS, VI2

Parameters
channelWhich configurable input channel to use, 1-2 (VC), 1-8 (VA), 1 (VS) or 1-4 (VI2), corresponding to physical input channel
frequencyMinimum frequency threshold, 0.0 - 50000.0 Hz for VC and VS, 0 - 15000 Hz for VA.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

float frequency_threshold;
channel = 2;
err = CfgIn_getMinFrequencyThreshold(pCfgIn, channel, &frequency_threshold);
if (err != ERR_SUCCESS)
{
cout << "CfgIn_getMinFrequencyThreshold: " << GetErrorStringA(err) << std::endl;
}
else
{
cout << "CfgIn_getMinFrequencyThreshold: channel 2: " << std::fixed << frequency_threshold << "Hz" << std::endl;
}

◆ CfgIn_getPwmValue()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::CfgIn_getPwmValue ( CFGINHANDLE  ,
uint8_t  channel,
float32_t frequency,
uint8_t duty_cycle 
)

Read the sampled value from configurable input, when in frequency measurement mode (CFGIN_FREQ_FLOATING, CFGIN_FREQ_PULLUP, CFGIN_FREQ_PULLDOWN).

Supported Platform(s): VC, VA

Parameters
channelWhich configurable input channel to use, 1 or 2, corresponding to physical input channel
frequencyRead signal frequency, 0.0 - 50000.0 Hz
duty_cycleRead signal duty cycle, 0-100%
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

float frequency;
unsigned char duty_cycle;
err = CfgIn_getPwmValue(pCfgIn, 2, &frequency, &duty_cycle);
if (err != ERR_SUCCESS)
{
cout << "CfgIn_getPwmValue: " << GetErrorStringA(err) << std::endl;
}
else
{
cout << "CfgIn_getPwmValue: channel 2 PWM measurement: " << std::fixed << frequency << "Hz, " << (int)duty_cycle << "% duty cycle" << std::endl;
}

◆ CfgIn_getValue()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::CfgIn_getValue ( CFGINHANDLE  ,
uint8_t  channel,
uint16_t sample_value 
)

Read the sampled value from configurable input, when in modes other than frequency mode:

For VC plaform: CFGIN_HI_SWITCH - sample_value is 0-1 CFGIN_LOW_SWITCH - sample_value is 0-1 CFGIN_VOLTAGE_2V5 - sample_value is 0-30000 (0.1mV steps) CFGIN_VOLTAGE_5V - sample_value is 0-60000 (0.1mV steps) CFGIN_RESISTANCE - sample_value is 0-65535 Ohm

For VA platform, all ports 1-8: CFGIN_CURRENT_4_20 - sample_value in µA, accuracy ± 0.5% ± 50 µA (typical) CFGIN_VOLTAGE_5V - sample_value in mV, accuracy ± 0.5% ± 5 mV (typical) CFGIN_VOLTAGE_10V - sample_value in mV, accuracy ± 0.5% ± 10 mV (typical) CFGIN_VOLTAGE_32V - sample_value in mV, accuracy ± 0.5% ± 32 mV (typical) CFGIN_DIGITAL_PD_5V - sample_value is 0-1 CFGIN_DIGITAL_PD_10V - sample_value is 0-1 CFGIN_DIGITAL_PD_32V - sample_value is 0-1 CFGIN_DIGITAL_F_5V - sample_value is 0-1 CFGIN_DIGITAL_F_10V - sample_value is 0-1 CFGIN_DIGITAL_F_32V - sample_value is 0-1

For VA platform, ports 1-4 only: CFGIN_RESISTANCE - sample_value in Ohm, accuracy ± 0.5% ± 5 Ohm (typical) CFGIN_RESISTANCE_500 - sample_value in 0.1 Ohm/bit, accuracy ± 0.5% ± 0.5 Ohm (typical)

For VA platform, ports 5-8 only: CFGIN_DIGITAL_PU_5V - sample_value is 0-1 CFGIN_DIGITAL_PU_10V - sample_value is 0-1 CFGIN_DIGITAL_PU_32V - sample_value is 0-1

For VS platform, input 1-2 in any mode: sample_value in mV.

For VI2 platform, all ports 1-4: CFGIN_HI_SWITCH - sample_value is 0-1 CFGIN_LOW_SWITCH - sample_value is 0-1 CFGIN_VOLTAGE_5V - sample_value is 0-5500 (1mV steps) CFGIN_RESISTANCE - sample_value is 0-500 (0.01 Ohm steps)

Supported Platform(s): VC, VA, VS, VI2

Parameters
channelWhich configurable input channel to use, 1-2 (VC), 1-8 (VA), 1 (VS) or 1-4 (VI2), corresponding to physical input channel
sample_valueRead value which is relevant to actual mode setting The actual value is dependent on the mode setting
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

unsigned short value;
err = CfgIn_getValue(pCfgIn, 1, &value);
if (err != ERR_SUCCESS)
{
cout << "CfgIn_getValue: " << GetErrorStringA(err) << std::endl;
}
else
{
cout << "CfgIn_getValue: channel 1 2V5 voltage measurement: " << (int)value << "mV" << std::endl;
}

◆ CfgIn_release()

EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV CrossControl::CfgIn_release ( CFGINHANDLE  )

Delete the CfgIn object.

Supported Platform(s): VC, VA, VS, VI2

Returns
-

Example Usage:

CFGINHANDLE pCfgIn = ::GetCfgIn();
assert(pCfgIn);
cfgin_example(pCfgIn);
CfgIn_release(pCfgIn);

◆ CfgIn_setCfgInMode()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::CfgIn_setCfgInMode ( CFGINHANDLE  ,
uint8_t  channel,
CfgInModeEnum  set_mode 
)

Set Configurable Input mode

Supported Platform(s): VC, VA, VS, VI2

Parameters
channelWhich configurable input channel to use, 1-2 (VC), 1-8 (VA), 1 (VS) or 1-4 (VI2), corresponding to physical input channel
set_modeWhich mode to set Configurable input can be set to different measurement modes. See CfgInModeEnum for a description of which platform and input combinations are possible.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

err = CfgIn_setCfgInMode(pCfgIn, channel, CFGIN_VOLTAGE_2V5);
if (err != ERR_SUCCESS)
{
cout << "CfgIn_setCfgInMode: " << GetErrorStringA(err) << std::endl;
}
else
{
cout << "CfgIn_setCfgInMode: channel 1 mode set to CFGIN_VOLTAGE_2V5" << std::endl;
}

◆ CfgIn_setFrequencyFilterLevel()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::CfgIn_setFrequencyFilterLevel ( CFGINHANDLE  ,
uint8_t  level 
)

Sets the weight of the old sample value in frequency measurements as a percentage. The sampled frequency is filtered with a moving average. A large weight increases the filter level and gives better accuracy in high frequency measurements, but decreases the speed of which changes in the input frequency can be detected.

Supported Platform(s): VC, VA

Parameters
levelWeight of the old sample value as a percentage (0-99)
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

◆ CfgIn_setMinFrequencyThreshold()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::CfgIn_setMinFrequencyThreshold ( CFGINHANDLE  ,
uint8_t  channel,
float32_t  frequency 
)

Set the minimum frequency threshold for configurable input, when in frequency measurement mode (CFGIN_FREQ_FLOATING, CFGIN_FREQ_PULLUP, CFGIN_FREQ_PULLDOWN for VC and VI2, and CFGIN_FREQ_PD_5V, CFGIN_FREQ_PD_10V, CFGIN_FREQ_PD_32V, CFGIN_FREQ_F_5V, CFGIN_FREQ_F_10V, CFGIN_FREQ_F_32V, CFGIN_FREQ_PU_5V, CFGIN_FREQ_PU_10V, CFGIN_FREQ_PU_32V for VA). The frequency threshold is set to 1Hz at device start-up. Use the frequency threshold to set up how fast to detect
a frequency change or a static signal. If you know the frequency range of the measured signal - set the threshold slightly lower than this. That way, a change from pulses to a static signal is detected as fast as possible. If the frequency threshold is set to e.g. 0.1Hz, it can take up to 10 seconds before a change in frequency is detected - also depending on the actual frequency of the signal. For VC, when the measured signal is slower than the frequency threshold, CfgIn_getPwmValue will return frequency 0Hz, duty cycle 0 or 100%. For VA, when the measured signal is slower than the frequency threshold, CfgIn_getFrequencyValue will return frequency 0 Hz. For VS, this function/setting only applies for input channel 1.

Supported Platform(s): VC, VA, VS, VI2

Parameters
channelWhich configurable input channel to use, 1-2 (VC), 1-8 (VA), 1 (VS) or 1-4 (VI2), corresponding to physical input channel
frequencyMinimum frequency threshold, 0.0 - 50000.0 Hz for VC, VS and VI2, 0-15000 Hz for VA.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

channel = 2;
err = CfgIn_setMinFrequencyThreshold(pCfgIn, channel, 50.0);
if (err != ERR_SUCCESS)
{
cout << "CfgIn_setMinFrequencyThreshold: " << GetErrorStringA(err) << std::endl;
}
else
{
cout << "CfgIn_setMinFrequencyThreshold: channel 2 minimum frequency threshold set to 50.0Hz" << std::endl;
}

◆ GetCfgIn()

EXTERN_C CCAUXDLL_API CFGINHANDLE CCAUXDLL_CALLING_CONV CrossControl::GetCfgIn ( void  )

Factory function that creates instances of the CfgIn object.

Supported Platform(s): VC, VA, VS, VI2

Returns
CFGINHANDLE to an allocated CfgIn object. The returned handle needs to be deallocated using the CfgIn_release(CFGINHANDLE) method when it's no longer needed. Returns NULL if it fails to allocate memory.

Example Usage:

CFGINHANDLE pCfgIn = ::GetCfgIn();
assert(pCfgIn);
cfgin_example(pCfgIn);
CfgIn_release(pCfgIn);