source: trunk/firmware_v4/SES/inc/sysdata.h@ 44

Last change on this file since 44 was 44, checked in by Zed, 31 hours ago

Es wurden zwei zusätzliche Register hinzugefügt.

File size: 4.2 KB
RevLine 
[42]1/*!
2 * \file : sysdata.h
3 * \brief : Header for sysdata.c file.
4 * This file contains the common defines of the application.
5 *
6 */
7
8#ifndef __SYS_DATA_H
9#define __SYS_DATA_H
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#include "stdint.h"
16
17#define CONCAT(a, b) CONCAT_INNER(a, b) // These three macros
18#define CONCAT_INNER(a, b) a ## b // generate unique variables
19#define UNIQUE_NAME(base) CONCAT(base, __COUNTER__) // according to template "baseX", like "base1", "base2" and etc.
20
21#define SAMPLE_ARRAY_SIZE 64
22
23//------------------------------------------------------------------------------
24
25typedef union
26{
27 uint16_t w;
28 int16_t sw;
29 uint8_t b[2];
30 int8_t sb[2];
31} bword_t;
32
33//------------------------------------------------------------------------------
34// This structure must be aligned to 4-byte address
35volatile typedef struct
36{
37 // Device spezifisch / Einstellungsbereich
38 uint16_t device_type; // 0 ECS interne Gertetyp Kennung (IHP 500 -> daher wird angedacht die Gerätekennung 500 zu nehmen)
39 uint16_t UNIQUE_NAME(reserved); // 1 Reserviert wg Alignement
40 uint32_t sn; // 2-3 Seriennummer Teil 1 -> wird bei der Produktion geschrieben
41
42 uint16_t fw_revision_major; // 4 Firmware Revision Major -> wird bei einer neuen Gertegeneration hochgezhlt
43 uint16_t fw_revision_minor; // 5 Firmware Revision Minor -> wird hochegezhlt, wenn nderungen in der Firmware auch nderungen in der Bedienungsanleitung zur Folge haben
44
45 uint16_t fw_revision_revision; // 6 Firmware Revision Revision -> wird bei jeder nderung der Firmware hochgezhlt
46 uint16_t UNIQUE_NAME(reserved); // 7 Reserviert wg Alignement
47
[44]48 uint32_t baudrate; // 8-9 Die Modbus Baudrate (default 19200 Bit/s). Gültig im Bereich von 50 Bit/s bis 1000 000 Bit/s
[42]49
50 uint16_t parityMode; // 10 UART Parity Mode (default EVEN) mgliche Werte 0=EVEN, 1=ODD, 2=NONE
51 uint16_t stopBit; // 11 UART Stop Bit Reserviert, Aktuell automatisch selektiert nach Modbus standart Bei Parity EVEN oder ODD 1, bei NONE werden 2 stopbits genutzt
52
53 uint16_t slave_address; // 12 Modbus Slave Adresse (default 1) mgliche Werte von 1 bis 247
54 uint16_t command; // 13 Kommando Word, das Schreiben bestimmter Werte in dieses Register fhrt bestimmte Aktionen aus
55
[44]56 uint16_t UNIQUE_NAME(reserved)[6]; // 14 - 19
[42]57
[44]58 uint16_t operatingMode; // 20
[42]59
[44]60 uint16_t UNIQUE_NAME(reserved)[79]; // 21 - 99
[42]61
62} device_parameter_t;
63
64//------------------------------------------------------------------------------
65// This structure must be aligned to 4-byte address
66volatile typedef struct
[44]67{ /* offset 0 */
68 /* 2 of 2 */ int16_t chipTemp; // 100
69 /* 2 of 2 */ int16_t relaisTemp; // 101
70 /* 2 of 2 */ uint16_t voltage_input; // 102
71 /* 2 of 2 */ uint16_t voltage_output; // 103
72 /* 2 of 2 */ int16_t voltage_relais; // 104
73 /* 2 of 2 */ int16_t fan_pwm; // 105
74 /* 2 of 2 */ int16_t fan_rpm; // 106
75 /* 2 of 2 */ int16_t ovp_state; // 107
76 /* 2 of 2 */ int16_t lvp_state; // 108
77 /* 2 of 2 */ int16_t fault_state; // 109
78 /* 2 of 2 */ int16_t relais_state; // 115
79 /* 2 of 2 */ int16_t smState; // 116
80 /* 2 of 2 */ int16_t smError; // 117
[42]81} device_values_t;
82
83//------------------------------------------------------------------------------
84
85typedef struct
86{
87 device_parameter_t parameter; // 0-99
88 device_values_t values; // 100
89} sys_data_struct_t;
90
91//------------------------------------------------------------------------------
92typedef volatile union
93{
94 sys_data_struct_t s;
95 bword_t mb[sizeof(sys_data_struct_t) / 2];
96} sys_data_t;
97
98//------------------------------------------------------------------------------
99
100extern sys_data_t sys_data;
101
102//------------------------------------------------------------------------------
103
104void SYS_DATA_Init(void);
105
106#ifdef __cplusplus
107}
108#endif
109
110#endif // __SYS_DATA_H
Note: See TracBrowser for help on using the repository browser.