Discussion in "PIC Microcontroller Discussion" started by    wewa    Jul 11, 2008.
Fri Jul 11 2008, 02:04 pm
#1
Hi!

I've got the problem, that if I declare a variable in a function, the interrupt is blocked.

#include <18F4525.h>

#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=19200, xmit=PIN_C6, rcv=PIN_C7, ERRORS, stream=PC)

int1 function() {
int32 cnt;  /*This seems to block the INTERRUPT #INT_RDA - But why?*/
while(1) {
}

} //END function

#INT_RDA
void seriell() {
char c;
c=getc(PC);
output_high(pin_b4);
} //END seriell

void main() {

ENABLE_INTERRUPTS(INT_RDA);      //serieller Empfang
ENABLE_INTERRUPTS(Global);

function(); 

   while (1) {
   } //END while
} //END main


Why does the declaration of a variable in a function block the interrupt?

PS: I use the CCS C Compiler with MPLAB and a PIC18F4525.
Fri Jul 11 2008, 08:49 pm
#2
I really don't know what you're trying to do in your program..

But i think you need to remove this from your function to make your program work perfectly, even along with variable declaration.

while(1) {
}


If that does not solve your problem can you explain me what you mean by blocking your interrupt and symptoms of your program when it is running with variable deceleration?
Fri Jul 11 2008, 09:50 pm
#3
sorry, the problem was somewhere else

In #INT_TIMER3 a function was called which waited on a action to be taken in #INT_RDA. And I think this was too much for the PIC.

But thanks for your help.

Problem solved.

PS: The while(1)-Loop is no problem, its not blocking an Interrupt.
With "blocking interrupt" I meant that something impeded that the µC jumped to the interrupt.
Thu Jul 17 2008, 08:54 pm
#4
Happy to hear that problem is solved Keep workin

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

ChrisLub
Tue Apr 23 2024, 05:21 pm
Davidbab
Tue Apr 23 2024, 10:41 am
Richardrit
Tue Apr 23 2024, 09:54 am
HenryLaf
Mon Apr 22 2024, 03:50 pm
bleradrar
Mon Apr 22 2024, 06:38 am
ppu-pro_ka
Sun Apr 21 2024, 07:39 pm
Infewow
Sun Apr 21 2024, 06:30 pm
HumanTak
Sun Apr 21 2024, 12:26 pm