source: trunk/firmware_v3/SES/inc/sysdata.h@ 41

Last change on this file since 41 was 41, checked in by f.jahn, 8 days ago

V3 Version soweit fertig. Relais ansteuerung, modbus, temperatursensor ist implementiert
Commit vor Änderung auf neuen Controller mit mehr Speicher

File size: 3.9 KB
Line 
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
48 uint32_t baudrate; // 8-9 Die Modbus Baudrate (default 19200 Bit/s). Gltig im Bereich von 50 Bit/s bis 1000 000 Bit/s
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
56 uint16_t res1[6];
57
58 uint16_t operatingMode;
59
60 uint16_t reserved[79];
61
62
63
64} device_parameter_t;
65
66//------------------------------------------------------------------------------
67// This structure must be aligned to 4-byte address
68volatile typedef struct
69{ /*offset 0*/
70 /* 2 of 8 */ int16_t chipTemp; // 100
71 /* 4 of 8 */ int16_t relaisTemp; // 101
72 /* 6 of 8 */ uint16_t voltage_input; // 102
73 /* 8 of 8 */ uint16_t voltage_output; // 103
74 /* 2 of 8 */ int16_t voltage_relais; // 104
75 /* 2 of 8 */ int16_t fan_pwm; // 105
76 /* 2 of 8 */ int16_t fan_rpm; // 106
77 /* 2 of 8 */ int16_t ovp_state; // 107
78 /* 2 of 8 */ int16_t lvp_state; // 108
79 /* 2 of 8 */ int16_t fault_state; // 109
80 /* 2 of 8 */ int16_t relais_state; // 115
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.