FORMAT OF DATA AND DESCRIPTOR STRUCTURE

The ZETSENSOR sensor parameters and settings are stored in internal storage in the form of the C language structures. A descriptor structure corresponds to each of the structures available for reading and writing.
The structure format is shown below (see Figure 1).

Формат структуры данных
Figure 1. Format of ZETSENSOR data structure 

STRUCT_HEAD has the following form:
typedef struct {
unsigned int size : 12;
unsigned int struct_type : 10;
unsigned int status : 10;
unsigned int write_enable : 16;
unsigned int usCRC16 : 16;
} STRUCT_HEAD;
where:
size – structure size;
struct_type – structure ID;
status – error ID;
write_enable – status in data writing;
usCRC16 – checksum.
The most important structures include DEV_PAR (structure with sensor identification data, structure ID is 0x18C) and CHANNEL_PAR (structure with the sensor measuring channel settings, structure ID is 0x0D0)
The DEV_PAR structure has the following form:
typedef struct {
STRUCT_HEAD head;
long type;
unsigned long long serial_num;
long compile_time;
long edition_time;
unsigned long dev_addr;
}
DEV_PAR;
where:
type – sensor type ID;
serial_num – sensor serial number;
compile_time – sensor software version;
edition_time – sensor settings last change time;
dev_addr – device address (1 to 63).
The CHANNEL_PAR has the following form
typedef struct {
STRUCT_HEAD head;
float value;
float frequency;
char measure[8];
char channel_name[32];
float min_level;
float max_level;
float reference;
float sense;
float resolution;
}
CHANNEL_PAR;
where:
value – current measured value, measurement unit;
frequency – data refresh rate in the channel, Hz;
measure – unit for a channel;
channel_name – channel name;
min_level – minimum measured value for a channel, unit;
max_level – maximum measured value for a channel, unit;
reference – reference value, unit;
sense – sensitivity, V per unit;
resolution – sensitivity threshold, unit;
The structures are located in the sensor memory one after another.