1 | /*
|
2 | Unterprog.Modul: c_Mittelwert_bestimmen_517A.c
|
3 | Letzte Änderung: 09.09.2005
|
4 | Programmierer: Thomas Stricker
|
5 |
|
6 | Public-Symbol: Mittelwert_bestimmen
|
7 | Funktion: Mittelwert
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | HeaderFile: Projekt.h
|
14 | I2C_BUS.h
|
15 | T_Projekt_817A.h
|
16 | Bibliothek: _.lib
|
17 | einbinden: void Mittelwert_bestimmen(void);
|
18 | */
|
19 |
|
20 |
|
21 |
|
22 | //#include <Technikerprojekt.h>
|
23 | //#include <I2C_BUS.h>
|
24 | //#include <T_Projekt_517A.h>
|
25 | //#include <Mittelwert_bestimmen.h>
|
26 | #ifndef Projekt
|
27 | #define Projekt
|
28 | #endif
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | void Mittelwert_bestimmen(void)
|
35 | {
|
36 | int hilf_TypID=0;
|
37 | int hilf_T=0;
|
38 | int hilf_F=0;
|
39 | int hilf_D=0;
|
40 | char teiler=0;
|
41 | unsigned char Sensor_s=0;
|
42 | //*************************************************************
|
43 | read_clock(); //Mittelwertbestimmung
|
44 | if(MID_z>0)
|
45 | {
|
46 | teiler=MID_z;
|
47 | hilf_TypID=MID[0][0];
|
48 | for(i=0;i<MID_z;i++)
|
49 | {
|
50 | hilf_T=hilf_T+MID[i][1];
|
51 | }
|
52 | hilf_T=(hilf_T/teiler);
|
53 | for(i=0;i<MID_z;i++)
|
54 | {
|
55 | hilf_F=hilf_F+MID[i][2];
|
56 | }
|
57 | hilf_F=(hilf_F/teiler);
|
58 | for(i=0;i<MID_z;i++)
|
59 | {
|
60 | hilf_D=hilf_D+MID[i][3];
|
61 | }
|
62 | hilf_D=(hilf_D/teiler);
|
63 | SID[SID_z][Sensor_s]=hilf_TypID;
|
64 | Sensor_s++;
|
65 | SID[SID_z][Sensor_s]=hilf_T;
|
66 | Sensor_s++;
|
67 | SID[SID_z][Sensor_s]=hilf_F;
|
68 | Sensor_s++;
|
69 | SID[SID_z][Sensor_s]=hilf_D;
|
70 | Sensor_s++;
|
71 | SID[SID_z][Sensor_s]=Stunden_Minuten_verketten();
|
72 | Sensor_s++;
|
73 | SID[SID_z][Sensor_s]=Sekunden_Tage_verketten();
|
74 | Sensor_s++;
|
75 | SID[SID_z][Sensor_s]=Monat_Jahr_verketten();
|
76 | Sensor_s=0;
|
77 | SID_z++;
|
78 | }
|
79 | else
|
80 | {
|
81 | }
|
82 | for(i=0;i<7;i++)
|
83 | {
|
84 | MID[i][0]=0;
|
85 | MID[i][1]=0;
|
86 | MID[i][2]=0;
|
87 | MID[i][3]=0;
|
88 | }
|
89 | MID_z=0;
|
90 | }
|