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

carpinteyrowrl
Fri Apr 19 2024, 02:51 pm
DonaldJAX
Fri Apr 19 2024, 01:08 pm
Lewisuhakeply
Thu Apr 18 2024, 06:00 pm
Darrellciz
Thu Apr 18 2024, 11:07 am
Charlessber
Thu Apr 18 2024, 09:29 am
BartonSem
Thu Apr 18 2024, 04:56 am
DonaldKnown
Thu Apr 18 2024, 12:24 am
utaletxcyw
Wed Apr 17 2024, 10:21 am