CANopen Slave Protocol Stack 
Version 7.06.00
Loading...
Searching...
No Matches
cos404ai.h File Reference

Detailed Description

This module implements the variables and callback functions for the object dictionary from CiA 404 (analog inputs). The module adds the following objects to the object dictionary:

Index Description Function / Variable Configuration Symbol
6100h AI input FV (float) Cos404_AI_SetFieldValue() COS_DS404_DT_FLOAT
6101h AI physical unit FV Cos404_AI_DefaultConfiguration()
6102h AI decimal digits FV Cos404_AI_DefaultConfiguration()
6110h AI sensor type Cos404_AI_DefaultConfiguration()
6112h AI operating mode Cos404_AI_DefaultConfiguration()
6126h AI scaling factor COS_DS404_AI_SCALING
6127h AI scaling offset COS_DS404_AI_SCALING
6130h AI input PV (float) Cos404_AI_SetFieldValue() COS_DS404_DT_FLOAT
6131h AI physical unit PV Cos404_AI_SetPhysicalUnitPV()
6132h AI decimal digits PV Cos404_AI_SetDecimalDigitsPV()
6138h AI tare Zero (float) COS_DS404_AI_TARE
6139h AI autotare COS_DS404_AI_TARE
6140h AI net PV (float) COS_DS404_AI_TARE
6148h AI span start (float) Cos404_AI_DefaultConfiguration()
6149h AI span stop (float) Cos404_AI_DefaultConfiguration()
614Ah AI lower error limit (float) Cos404_AI_DefaultConfiguration()
614Bh AI upper error limit (float) Cos404_AI_DefaultConfiguration()
6150h AI status Cos404_AI_SetFieldValue()
61A0h AI filter type COS_DS404_AI_FILTER
61A1h AI filter constant COS_DS404_AI_FILTER
7100h AI input FV (int16_t) COS_DS404_DT_INT16
7130h AI input PV (int16_t) COS_DS404_DT_INT16
7138h AI tare Zero (int16_t) COS_DS404_AI_TARE
7140h AI net PV (int16_t) COS_DS404_AI_TARE
7148h AI span start (int16_t) Cos404_AI_DefaultConfiguration() COS_DS404_DT_INT16
7149h AI span stop (int16_t) Cos404_AI_DefaultConfiguration() COS_DS404_DT_INT16
714Ah AI lower error limit (int16_t) Cos404_AI_DefaultConfiguration() COS_DS404_DT_INT16
714Bh AI upper error limit (int16_t) Cos404_AI_DefaultConfiguration() COS_DS404_DT_INT16
9100h AI input FV (int32_t) Cos404_AI_SetFieldValue() COS_DS404_DT_INT32
9130h AI input PV (int32_t) Cos404_AI_SetFieldValue() COS_DS404_DT_INT32
9138h AI tare Zero (int32_t) COS_DS404_AI_TARE
9140h AI net PV (int32_t) COS_DS404_AI_TARE
9148h AI span start (int32_t) Cos404_AI_DefaultConfiguration() COS_DS404_DT_INT32
9149h AI span stop (int32_t) Cos404_AI_DefaultConfiguration() COS_DS404_DT_INT32
914Ah AI lower error limit (int32_t) Cos404_AI_DefaultConfiguration() COS_DS404_DT_INT32
914Bh AI upper error limit (int32_t) Cos404_AI_DefaultConfiguration() COS_DS404_DT_INT32

An example for the module is given inside the file cos404ai_app.c which is located inside the template-cos directory.

Module initialisation

The analog input module is initialised for each individual analog input by calling Cos404_AI_DefaultConfiguration() prior to CosMgrStart(). The order of function calls is important because CosMgrStart() may overwrite parameters of the analog input module in case values have been stored in non-volatile memory (refer to object 1010h).

void Cos404_AI_AppInit(void)
{
uint32_t ulPhysicalUnitT;
//---------------------------------------------------------------------------------------------------
// perform initial configuration for CiA 404 AI software module by user application
//
memset(&tsConfigurationS, 0, sizeof(Cos404_AI_Config_ts));
//---------------------------------------------------------------------------------------------------
// set sensor type and operation mode
//
tsConfigurationS.uwIdx6110_DefaultSensorType = eCOS404_AI_ST_VOLT_10V_BIP;
tsConfigurationS.ubIdx6112_DefaultOpMode = 1;
tsConfigurationS.ulIdx6101_PhysicalUnitFV = ulPhysicalUnitT;
tsConfigurationS.ubIdx6102_DecimalDigitsInt16FV = COS_DS404_AI_FV_DIGITS_INT16;
tsConfigurationS.ubIdx6102_DecimalDigitsInt32FV = COS_DS404_AI_FV_DIGITS_INT32;
tsConfigurationS.ulIdx6131_PhysicalUnitPV = ulPhysicalUnitT;
tsConfigurationS.ubIdx6132_DecimalDigitsInt32PV = COS_DS404_AI_FV_DIGITS_INT32;
tsConfigurationS.slIdx9148_SpanStart = -100000000;
tsConfigurationS.slIdx9149_SpanEnd = 100000000;
tsConfigurationS.slIdx914A_LowerErrorLimit = -110000000;
tsConfigurationS.slIdx914B_UpperErrorLimit = 110000000;
//---------------------------------------------------------------------------------------------------
// if filter support is enabled: register function for filter parameter update
//
#if COS_DS404_AI_FILTER > 0
tsConfigurationS.pfnFilterUpdateEvent = Cos404_AI_AppEventFilterUpdate;
#endif
//---------------------------------------------------------------------------------------------------
// register function for sensor type update
//
tsConfigurationS.pfnSensorTypeEvent = Cos404_AI_AppEventSensorType;
//---------------------------------------------------------------------------------------------------
// register function for operating mode update
//
tsConfigurationS.pfnOperatingModeEvent = Cos404_AI_AppEventOperatingMode;
}
@ eCOS404_AI_ST_VOLT_10V_BIP
Definition cos404ai.h:349
#define COS890_PHYSICAL_UNIT(SiPrefix, SiNumerator, SiDenominator, Profile)
Definition cos890.h:157
@ eCOS890_SI_UNIT_NONE
dimensionless
Definition cos890.h:70
@ eCOS890_SI_UNIT_VOLT
volt [V]
Definition cos890.h:88
@ eCOS890_SI_PREFIX_NONE
no prefix, 100
Definition cos890.h:58

Analog value processing

The values for AI status and AI field value are provided to the module by calling Cos404_AI_SetFieldValue(). To consider the CiA 404 AI filter configuration, the user must call Cos404_AI_Filter() beforehand and provide the filtered value to the Cos404_AI_SetFieldValue() function.

The field value will be scaled according to the scaling parameters defined via index 6126h and 6127h. Additionally, the user can provide a pointer to a scale handler during initialisation that will be called to scale the field value.

void Cos404_AI_AppProcess(void)
{
int32_t slFieldValueT = 10000;
uint8_t ubChannelT;
//---------------------------------------------------------------------------------------------------
// Process all existing AI channels
//
ubChannelT = eCOS404_CHANNEL_1;
while (ubChannelT < COS_DS404_AI)
{
//-------------------------------------------------------------------------------------------
// read analog values from ADC, check status
//
// slFieldValueT = field value
//
// ftProcessValueT = process value
//
//-------------------------------------------------------------------------------------------
// provide values and their status to the CiA 404
//
Cos404_AI_SetFieldValue(ubChannelT, slFieldValueT, true);
ubChannelT++;
}
}
@ eCOS404_CHANNEL_1
Definition cos404.h:161
void Cos404_AI_SetFieldValue(uint8_t ubChannelV, int32_t slFieldValueV, bool_t btStatusV)
#define COS_DS404_AI
Support CiA 404, analog inputs.
Definition cos_conf.h:249
Include dependency graph for cos404ai.h:

Data Structures

struct  Cos404_AI_Config_s
struct  Cos404_AI_ProcessData_s

Macros

#define COS_DS404_AI_FV_REAL32_OFF   (float)(0.0)
#define COS_DS404_AI_PV_REAL32_OFF   (float)(0.0)
#define COS_DS404_AI_FV_INT16_OFF   (int16_t)(0)
#define COS_DS404_AI_PV_INT16_OFF   (int16_t)(0)
#define COS_DS404_AI_FV_INT32_OFF   (int32_t)(0)
#define COS_DS404_AI_PV_INT32_OFF   (int32_t)(0)
#define COS_DS404_AI_TARE_SIGNATURE   0x65726174
#define COS_DS404_AI_FILTER_MOV_AV   0
#define COS_DS404_AI_FILTER_REP_AV   0

Typedefs

typedef uint8_t(* Cos404AiOpMode_fn) (uint8_t ubChannelV, uint8_t ubModeV)
typedef uint8_t(* Cos404AiSensorType_fn) (uint8_t ubChannelV, uint16_t uwSensorTypeV)
typedef int32_t(* Cos404AiLinearisation_fn) (uint8_t ubChannelV, int32_t slValueV, uint16_t uwSensorTypeV)

Enumerations

enum  Cos404_AI_OpMode_e {
  eCOS404_AI_OP_MODE_OFF = 0 ,
  eCOS404_AI_OP_MODE_ON
}
enum  Cos404_AI_SensorType_e {
  eCOS404_AI_ST_UNKNOWN = 0 ,
  eCOS404_AI_ST_THERMO_J = 1 ,
  eCOS404_AI_ST_THERMO_K ,
  eCOS404_AI_ST_THERMO_L ,
  eCOS404_AI_ST_THERMO_N ,
  eCOS404_AI_ST_THERMO_R ,
  eCOS404_AI_ST_THERMO_S ,
  eCOS404_AI_ST_THERMO_T ,
  eCOS404_AI_ST_THERMO_U ,
  eCOS404_AI_ST_THERMO_E ,
  eCOS404_AI_ST_THERMO_B ,
  eCOS404_AI_ST_PT100 = 30 ,
  eCOS404_AI_ST_PT200 ,
  eCOS404_AI_ST_PT500 ,
  eCOS404_AI_ST_PT1000 ,
  eCOS404_AI_ST_PT5000 ,
  eCOS404_AI_ST_INFRARED ,
  eCOS404_AI_ST_VOLT = 40 ,
  eCOS404_AI_ST_VOLT_10V_BIP ,
  eCOS404_AI_ST_VOLT_10V_UNI ,
  eCOS404_AI_ST_VOLT_1V_BIP ,
  eCOS404_AI_ST_VOLT_1V_UNI ,
  eCOS404_AI_ST_VOLT_100mV_BIP ,
  eCOS404_AI_ST_VOLT_100mV_UNI ,
  eCOS404_AI_ST_CURR = 50 ,
  eCOS404_AI_ST_CURR_4_20mA ,
  eCOS404_AI_ST_CURR_0_20mA ,
  eCOS404_AI_ST_FREQUENCY = 60 ,
  eCOS404_AI_ST_GAUGE = 70 ,
  eCOS404_AI_ST_GAUGE_FULL ,
  eCOS404_AI_ST_GAUGE_HALF ,
  eCOS404_AI_ST_GAUGE_QUARTER ,
  eCOS404_AI_ST_LVDT = 80 ,
  eCOS404_AI_ST_PRESSURE_TRANSDUCER = 90 ,
  eCOS404_AI_ST_TEMPERATURE_TRANSDUCER = 100 ,
  eCOS404_AI_ST_FORCE_TRANSDUCER = 110 ,
  eCOS404_AI_ST_POTENTIOMETER = 120 ,
  eCOS404_AI_ST_NTC = 140 ,
  eCOS404_AI_ST_MANUFACTURER_1 = 10000 ,
  eCOS404_AI_ST_MANUFACTURER_2 ,
  eCOS404_AI_ST_MANUFACTURER_3 ,
  eCOS404_AI_ST_MANUFACTURER_4 ,
  eCOS404_AI_ST_MANUFACTURER_5
}
enum  Cos404_AI_Status_te {
  eCOS404_AI_STATUS_OK = 0x00 ,
  eCOS404_AI_STATUS_NOT_VALID = 0x01 ,
  eCOS404_AI_STATUS_POS_OVERLOAD = 0x02 ,
  eCOS404_AI_STATUS_NEG_OVERLOAD = 0x04 ,
  eCOS404_AI_STATUS_SYNC_LOST = 0x08 ,
  eCOS404_AI_STATUS_TEDS_ERROR = 0x10 ,
  eCOS404_AI_STATUS_TEDS_PRESENT = 0x20 ,
  eCOS404_AI_STATUS_DICT_CHANGED = 0x40 ,
  eCOS404_AI_STATUS_ERROR_LIMIT = 0x80
}
enum  Cos404_AI_FilterType_e { eCOS404_AI_FILTER_TYPE_NONE = 0 , eCOS404_AI_FILTER_TYPE_MOVING_AVERAGE = 1 , eCOS404_AI_FILTER_TYPE_REPEATING_AVERAGE = 2 , eCOS404_AI_FILTER_TYPE_MANUFACTURER_01 = 100 , eCOS404_AI_FILTER_TYPE_MANUFACTURER_02 = 101 , eCOS404_AI_FILTER_TYPE_MANUFACTURER_03 = 102 , eCOS404_AI_FILTER_TYPE_MANUFACTURER_04 = 103 }

Functions

Cos404_AI_Config_tsCos404_AI_DefaultConfiguration (uint8_t ubChannelV)
Cos404_AI_FilterParm_ts * Cos404_AI_GetFilterParameter (uint8_t ubChannelV)
uint8_t Cos404_AI_GetOperatingMode (uint8_t ubChannelV)
uint16_t Cos404_AI_GetSensorType (uint8_t ubChannelV)
Cos404_AI_Status_te Cos404_AI_Process (uint8_t ubChannelV)
uint8_t Cos404_AI_SetDecimalDigitsPV (uint8_t ubChannelV, uint8_t ubDigitsV)
void Cos404_AI_SetFieldValue (uint8_t ubChannelV, int32_t slFieldValueV, bool_t btStatusV)
uint8_t Cos404_AI_SetPhysicalUnitPV (uint8_t ubChannelV, uint32_t ulPhysicalUnitV)

Variables

Cos404_AI_ProcessData_ts atsCos404_AI_ProcessDataG []

Macro Definition Documentation

◆ COS_DS404_AI_FILTER_MOV_AV

#define COS_DS404_AI_FILTER_MOV_AV   0

Support of CiA 404 moving average filter.

  • 0 : do not support CiA 404 moving average filter
  • 1 : support CiA 404 moving average filter

◆ COS_DS404_AI_FILTER_REP_AV

#define COS_DS404_AI_FILTER_REP_AV   0

Support of CiA 404 repeating average filter.

  • 0 : do not support CiA 404 repeating average filter
  • N : support CiA 404 repeating average filter

◆ COS_DS404_AI_FV_INT16_OFF

#define COS_DS404_AI_FV_INT16_OFF   (int16_t)(0)

Definition for field value of data type int16_t when channel is disabled.

◆ COS_DS404_AI_FV_INT32_OFF

#define COS_DS404_AI_FV_INT32_OFF   (int32_t)(0)

Definition for field value of data type int32_t when channel is disabled.

◆ COS_DS404_AI_FV_REAL32_OFF

#define COS_DS404_AI_FV_REAL32_OFF   (float)(0.0)

Definition for field value of data type float when channel is disabled.

◆ COS_DS404_AI_PV_INT16_OFF

#define COS_DS404_AI_PV_INT16_OFF   (int16_t)(0)

Definition for process value of data type int16_t when channel is disabled.

◆ COS_DS404_AI_PV_INT32_OFF

#define COS_DS404_AI_PV_INT32_OFF   (int32_t)(0)

Definition for process value of data type int32_t when channel is disabled.

◆ COS_DS404_AI_PV_REAL32_OFF

#define COS_DS404_AI_PV_REAL32_OFF   (float)(0.0)

Definition for process value of data type float when channel is disabled.

◆ COS_DS404_AI_TARE_SIGNATURE

#define COS_DS404_AI_TARE_SIGNATURE   0x65726174

Define specified 'tare' value for write access to AI tare index 6139h

Typedef Documentation

◆ Cos404AiLinearisation_fn

typedef int32_t(* Cos404AiLinearisation_fn) (uint8_t ubChannelV, int32_t slValueV, uint16_t uwSensorTypeV)
Parameters
[in]ubChannelVAnalog input channel
[in]slValueVField value to be linearised
Returns
Linearised field value

Event handler for manufacturer-specific linearisation of the field value, called by the module during value processing. The handler can be registered during initialisation by Cos404_AI_DefaultConfiguration() for each channel.

The parameter ubChannelV defines the channel number, the first channel starts at eCOS404_CHANNEL_1.

◆ Cos404AiOpMode_fn

typedef uint8_t(* Cos404AiOpMode_fn) (uint8_t ubChannelV, uint8_t ubModeV)
Parameters
[in]ubChannelVAnalog input channel
[in]ubModeVRequested operating mode
Returns
eCosSdo_WRITE_OK on success or any other value from CosSdo_e in case of an error

Event handler which is called upon a change of operating mode, defined by parameter ubModeV. The handler can be registered during initialisation by Cos404_AI_DefaultConfiguration() for each channel.

The parameter ubChannelV defines the channel number, the first channel starts at eCOS404_CHANNEL_1.

◆ Cos404AiSensorType_fn

typedef uint8_t(* Cos404AiSensorType_fn) (uint8_t ubChannelV, uint16_t uwSensorTypeV)
Parameters
[in]ubChannelVAnalog input channel
[in]uwSensorTypeVRequested sensor type value
Returns
eCosSdo_WRITE_OK on success or any other value from CosSdo_e in case of an error

Event handler which is called upon a change of sensor type, defined by parameter uwSensorTypeV. The handler can be registered during initialisation by Cos404_AI_DefaultConfiguration() for each channel.

The parameter ubChannelV defines the channel number, the first channel starts at eCOS404_CHANNEL_1.

Enumeration Type Documentation

◆ Cos404_AI_FilterType_e

Values for AI Filter type from CiA 404, object 61A0h

Enumerator
eCOS404_AI_FILTER_TYPE_NONE 

No filter

◆ Cos404_AI_OpMode_e

Values for AI operating mode object at index 6112h.

Enumerator
eCOS404_AI_OP_MODE_OFF 

channel is switched off

eCOS404_AI_OP_MODE_ON 

channel is switched on

◆ Cos404_AI_SensorType_e

Values for AI Sensor Types corresponding to CiA 404, object 6110

Enumerator
eCOS404_AI_ST_UNKNOWN 

Sensor type is unknown

eCOS404_AI_ST_THERMO_J 

Thermocouple type J

eCOS404_AI_ST_THERMO_K 

Thermocouple type K

eCOS404_AI_ST_THERMO_L 

Thermocouple type L

eCOS404_AI_ST_THERMO_N 

Thermocouple type N

eCOS404_AI_ST_THERMO_R 

Thermocouple type R

eCOS404_AI_ST_THERMO_S 

Thermocouple type S

eCOS404_AI_ST_THERMO_T 

Thermocouple type T

eCOS404_AI_ST_THERMO_U 

Thermocouple type U

eCOS404_AI_ST_THERMO_E 

Thermocouple type E

eCOS404_AI_ST_THERMO_B 

Thermocouple type B

eCOS404_AI_ST_PT100 

PT100

eCOS404_AI_ST_PT200 

PT200

eCOS404_AI_ST_PT500 

PT500

eCOS404_AI_ST_PT1000 

PT1000

eCOS404_AI_ST_PT5000 

PT5000

eCOS404_AI_ST_INFRARED 

IR-sensor

eCOS404_AI_ST_VOLT 

Voltage

eCOS404_AI_ST_VOLT_10V_BIP 

± 10 V

eCOS404_AI_ST_VOLT_10V_UNI 

0 to 10 V

eCOS404_AI_ST_VOLT_1V_BIP 

± 1 V

eCOS404_AI_ST_VOLT_1V_UNI 

0 to 1 V

eCOS404_AI_ST_VOLT_100mV_BIP 

± 100 mV

eCOS404_AI_ST_VOLT_100mV_UNI 

0 to 100 mV

eCOS404_AI_ST_CURR 

Current

eCOS404_AI_ST_CURR_4_20mA 

4 to 20 mA

eCOS404_AI_ST_CURR_0_20mA 

0 to 20 mA

eCOS404_AI_ST_FREQUENCY 

Frequency

eCOS404_AI_ST_GAUGE 

Strain gauge

eCOS404_AI_ST_GAUGE_FULL 

Strain gauge full bridge

eCOS404_AI_ST_GAUGE_HALF 

Strain gauge half bridge

eCOS404_AI_ST_GAUGE_QUARTER 

Strain gauge quarter bridge

eCOS404_AI_ST_LVDT 

Inductive sensors

eCOS404_AI_ST_PRESSURE_TRANSDUCER 

Pressure transducer

eCOS404_AI_ST_TEMPERATURE_TRANSDUCER 

Temperature transducer

eCOS404_AI_ST_FORCE_TRANSDUCER 

Sensors for vibration measurement

eCOS404_AI_ST_POTENTIOMETER 

Potentiometer

eCOS404_AI_ST_NTC 

NTC

eCOS404_AI_ST_MANUFACTURER_1 

Manufacturer-specific senor type 1

eCOS404_AI_ST_MANUFACTURER_2 

Manufacturer-specific senor type 2

eCOS404_AI_ST_MANUFACTURER_3 

Manufacturer-specific senor type 3

eCOS404_AI_ST_MANUFACTURER_4 

Manufacturer-specific senor type 4

eCOS404_AI_ST_MANUFACTURER_5 

Manufacturer-specific senor type 5

◆ Cos404_AI_Status_te

Values for AI Status from CiA 404, object 6150h

Enumerator
eCOS404_AI_STATUS_OK 

All OK

eCOS404_AI_STATUS_NOT_VALID 

Not valid

eCOS404_AI_STATUS_POS_OVERLOAD 

Positive overload

eCOS404_AI_STATUS_NEG_OVERLOAD 

Negative overload

eCOS404_AI_STATUS_SYNC_LOST 

Synchronisation of the signal lost

eCOS404_AI_STATUS_TEDS_ERROR 

TEDS error warning

eCOS404_AI_STATUS_TEDS_PRESENT 

TEDS sensor present

eCOS404_AI_STATUS_DICT_CHANGED 

Object dictionary changed

eCOS404_AI_STATUS_ERROR_LIMIT 

Error limit exceeded

Function Documentation

◆ Cos404_AI_DefaultConfiguration()

Cos404_AI_Config_ts * Cos404_AI_DefaultConfiguration ( uint8_t ubChannelV)
Parameters
[in]ubChannelVAnalog input channel, starting at eCOS404_CHANNEL_1, maximum value is defined by COS_DS404_AI
Returns
Pointer to configuration data of type Cos404_AI_Config_ts

This function is called during initialisation of an analog input channel defined by ubChannelV. It returns a pointer to a static default configuration of type Cos404_AI_Config_ts for that channel.

◆ Cos404_AI_GetFilterParameter()

Cos404_AI_FilterParm_ts * Cos404_AI_GetFilterParameter ( uint8_t ubChannelV)
Parameters
[in]ubChannelVAnalog input channel, starting at eCOS404_CHANNEL_1, maximum value is defined by COS_DS404_AI
Returns
Pointer to the filter parameter structure of type #Cos404_AI_FilterParm_ts for the given channel, or NULL in case of an invalid channel parameter.

This function returns a pointer to the filter parameter structure of the analog input channel defined by ubChannelV. The structure provides read access to the active filter type (object 61A0h) and filter constant (object 61A1h), as well as the internal filter state data used by the filter implementation.
This function is only available if COS_DS404_AI_FILTER is greater than 0.

◆ Cos404_AI_GetOperatingMode()

uint8_t Cos404_AI_GetOperatingMode ( uint8_t ubChannelV)
Parameters
[in]ubChannelVAnalog input channel
Returns
Value from Cos404_AI_OpMode_e enumeration. In case of a wrong channel parameter or a not fully initialised channel the return value is eCOS404_AI_OP_MODE_OFF .

This function returns the currently active operating mode of the analog input channel defined by ubChannelV (object 6112h).

◆ Cos404_AI_GetSensorType()

uint16_t Cos404_AI_GetSensorType ( uint8_t ubChannelV)
Parameters
[in]ubChannelVAnalog input channel
Returns
Value from Cos404_AI_SensorType_e enumeration. In case of a wrong channel parameter or a not fully initialised channel the return value is eCOS404_AI_ST_UNKNOWN .

This function returns the currently active sensor type of the analog input channel defined by ubChannelV (object 6110h).

◆ Cos404_AI_Process()

Cos404_AI_Status_te Cos404_AI_Process ( uint8_t ubChannelV)
Parameters
[in]ubChannelVAnalog input channel
Returns
eCosSdo_WRITE_OK on success, or any other value from CosSdo_e in case of an error

◆ Cos404_AI_SetDecimalDigitsPV()

uint8_t Cos404_AI_SetDecimalDigitsPV ( uint8_t ubChannelV,
uint8_t ubDigitsV )
Parameters
[in]ubChannelVAnalog input channel
[in]ubDigitsVNumber of decimal digits
Returns
eCosSdo_WRITE_OK on success or any other value from CosSdo_e in case of an error

This function should be called by application at change of sensor type to define number of decimal digits of provided process value.

◆ Cos404_AI_SetFieldValue()

void Cos404_AI_SetFieldValue ( uint8_t ubChannelV,
int32_t slFieldValueV,
bool_t btStatusV )
Parameters
[in]ubChannelVAnalog input channel
[in]slFieldValueV32 bit value, that represent RAW value for example of an ADC
[in]btStatusVProvides the status that the analog input values are valid or not

This function sets the field value (index x100h) slFieldValueV and the input status (index 6150h) ubStatusV for the analog input channel defined by ubChannelV.

The function updates the objects for all supported data types (refer to COS_DS404_DT_INT16, COS_DS404_DT_INT32 and COS_DS404_DT_FLOAT).

Please refer to the section Analog value processing for an example.

◆ Cos404_AI_SetPhysicalUnitPV()

uint8_t Cos404_AI_SetPhysicalUnitPV ( uint8_t ubChannelV,
uint32_t ulPhysicalUnitV )
Parameters
[in]ubChannelVAnalog input channel
[in]ulPhysicalUnitVPhysical unit of the process value
Returns
eCosSdo_WRITE_OK on success or any other value from CosSdo_e in case of an error

This function should be called by application at change of sensor type to define corresponding physical unit of provided process value.

The cos890.h contains the COS890_PHYSICAL_UNIT() macro and Cos890_SI_Unit_e to setup this value.

Variable Documentation

◆ atsCos404_AI_ProcessDataG

Cos404_AI_ProcessData_ts atsCos404_AI_ProcessDataG[]
extern

This array holds process data values that are accessible via SDO and PDO. It is declared as a global variable to allow PDO mapping.