Forum: Mikrocontroller und Digitale Elektronik Interrupt wird von UP geblockt (PIC, CCS C)


von C. W. (htbl)


Lesenswert?

Hallo!

Ich habe das Problem, dass wenn ich ein UP mit einer while-Schleife 
darin aufrufe, irgendwie der Interrupt blockiert wird. (Das Programm 
springt dann nicht in den Interrupt.)
Wenn ich hingegen dieses UP nicht aufrufe, funktioniert der Interrupt 
tadellos.

Mein Programm sieht so ähnlich aus:
1
#include <18F4525.h>
2
#fuses HS,NOWDT,NOPROTECT,NOLVP
3
#use delay(clock=20000000)
4
#use rs232(baud=19200, xmit=PIN_C6, rcv=PIN_C7, ERRORS, stream=PC)
5
6
int1 function() {
7
int32 cnt;
8
while(1) {
9
}
10
if(cnt<1000) {return TRUE;}
11
else{return FALSE;}
12
} //END function
13
14
#INT_RDA
15
void seriell() {
16
output_high(pin_b4);
17
} //END seriell
18
19
void main() {
20
21
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);   //für seriellen Empfang
22
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256);   
23
ENABLE_INTERRUPTS(INT_RDA);      //serieller Empfang
24
ENABLE_INTERRUPTS(Global);
25
26
function(); /*This seems to block the serial Interrupt, if I don't call this function serial Interrupt fires.*/
27
28
   while (1) {
29
   } //END while
30
} //END main

von C. W. (htbl)


Lesenswert?

Ich habe nun herausgefunden, dass die Deklaration einer Variable (z.B. 
cnt) im UP den Interrupt irgendwie blockiert.
Wird diese Variable nicht deklariert, funktioniert der Interrupt.

Aber warum?

von C. W. (htbl)


Lesenswert?

Das Problem war sonst wo.

-Problem gelöst-

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.