hallo ich hab folgendes problem: wenn ich die variable int timervalue =0; innerhalb von int main(void) deklariere und in case2 mit TIM3Freq beschreib bekomme ich vom komp. die meldung: main.c(32): warning: #550-D: variable "timervalue" was set but never used bzw. main.c(32): warning: #177-D: variable "timervalue" was declared but never referenced wenn ich timervalue = TIM3Freq(in case2) auskommentiere beim debuggen steht dann im Watch Fenster(uVision4) bei timervalue nur ?????? und kein hexwert(wie normalerweise) schreib ich die deklaration aber vor/außerhalb int main(void) klappts und timervalue wird plötzlich ein wert zugewiesen(beim debuggen) unter: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0434a/index.html findet man die fehlerbeschreibungen(die mir das problem aber leider nicht erklären) wieso funkts bei deklaration außerhalb von main und innerhalb nicht ?? danke ! PS: TIM3Freq kommt vom interrupt handler file und hat den entsprechenden capture wert des timers(also ich glaub das kann ich als fehlerquelle ausschließen)
1 | #include "stm32f10x.h" |
2 | #include "stm32f10x_conf.h" |
3 | |
4 | |
5 | //gate treiber einschaltdauaer
|
6 | #define gateondelay 250
|
7 | #define gateoffdelay 600
|
8 | |
9 | //relais waits
|
10 | #define relayondelay 1200
|
11 | #define relayoffdelay 300
|
12 | |
13 | void TimerInit(void); //Timer 3 Ch_1 = PA6 |
14 | void SetSysClockTo72(void); |
15 | void GPIOInit(void); |
16 | void RCCInit(void); |
17 | void NVICInit(void); |
18 | |
19 | //uint32_t TIM3Freq;
|
20 | |
21 | void Delay(__IO uint32_t nTime); |
22 | void TimingDelay_Decrement(void); |
23 | void systickconf(void); |
24 | int timervalue =0; |
25 | |
26 | int main(void) |
27 | {
|
28 | |
29 | |
30 | int x=0;//12000 entspricht 1s |
31 | |
32 | |
33 | SetSysClockTo72(); |
34 | RCCInit(); |
35 | TimerInit(); |
36 | GPIOInit(); |
37 | NVICInit(); |
38 | systickconf(); |
39 | |
40 | |
41 | //Delay(12); // 12 dauert 1 ms
|
42 | |
43 | while (1) |
44 | {
|
45 | |
46 | switch (x) |
47 | {
|
48 | case 0: |
49 | |
50 | // GPIO_ResetBits(GPIOB, GPIO_Pin_12); //Relais 2 aus
|
51 | Delay(relayondelay); |
52 | GPIO_SetBits(GPIOB, GPIO_Pin_11); //Relais 1 ein |
53 | |
54 | Delay(gateondelay); |
55 | GPIO_SetBits(GPIOB, GPIO_Pin_10); //Pulse in ein |
56 | Delay(gateoffdelay); |
57 | GPIO_ResetBits(GPIOB, GPIO_Pin_10); |
58 | Delay(relayoffdelay); |
59 | GPIO_ResetBits(GPIOB, GPIO_Pin_11); |
60 | x++; |
61 | |
62 | break; |
63 | case 1: |
64 | |
65 | // GPIO_ResetBits(GPIOB, GPIO_Pin_11); //Relais 1 aus
|
66 | Delay(relayondelay); |
67 | GPIO_SetBits(GPIOB, GPIO_Pin_12); //Relais 2 ein |
68 | |
69 | Delay(gateondelay); |
70 | GPIO_SetBits(GPIOB, GPIO_Pin_10); //Pulse in ein |
71 | Delay(gateoffdelay); |
72 | GPIO_ResetBits(GPIOB, GPIO_Pin_10); |
73 | Delay(relayoffdelay); |
74 | GPIO_ResetBits(GPIOB, GPIO_Pin_12); |
75 | x++; |
76 | break; |
77 | case 2: |
78 | |
79 | //ausgabe der capture werte
|
80 | timervalue = TIM3Freq; |
81 | |
82 | break; |
83 | |
84 | }
|
85 | |
86 | if(x==3) //x=case (n+1) |
87 | {
|
88 | x=0; |
89 | }
|
90 | |
91 | |
92 | }
|
93 | |
94 | |
95 | }
|