MikroC debug problem

Thread Starter

blackmamba

Joined Dec 4, 2009
16
Hello. I am having a problem with this right now. Using mikroc, while debugging, I am seeing that the interrupt condition is being met, but the program is not entering the interrupt function. What could be causing this?
 

Thread Starter

blackmamba

Joined Dec 4, 2009
16
The OP is no longer posting here. said this was wrong forum. No need to create another post. I think you can help me with this sir.

Rich (BB code):
void pin5_interrupt ()
{
if (INTCON.INTF==1)
        {
        INTCON.INTF=0;
        //GPIO.F0=1;
        //Vdelay_ms(dim_delay+offset_delay);
        GPIO.F0=0;
        delay_ms(1000);
        }
        GPIO.F0=1;
}
The above interrupt does not work even after the condition is met while debugging. I need help with this. What do you think is wrong?
 

Dalaran

Joined Dec 3, 2009
168
I don't know if you can specify an interrupt like that? Try:

Rich (BB code):
void interrupt(void){
}
The above is working for me.

You can also use the below for "low priority" interrupts:
Rich (BB code):
void interrupt_low(void){
}
Cheers.
 

spinnaker

Joined Oct 29, 2009
7,830
  1. Exactly what are you trying to do?
  2. What MCU are you using?
  3. What makes you think the interrupt is being triggered?
  4. Post all of you code.
 

SgtWookie

Joined Jul 17, 2007
22,230
Dalaran posted the solution.
Blackmamba was not following the correct prototype for interrupt handling.
Had Blackmamba looked at the documentation page I referred to (mikroC manual, the mikroC Language Reference under mikroC Specifics, on page 36) in the other thread, he would have seen the prototype:
Rich (BB code):
void interrupt(void){
}
that Dalaran posted.
 

Dalaran

Joined Dec 3, 2009
168
Yup. Thanks sgt. Also I think the delay function is
Rich (BB code):
Delay_ms()
maybe the small "d" works. And (haven't checked in MikroC) but in MPLAB the limit for Delay_ms() was ~200, not sure if that applies here, but it might not be including the full delay. You could change that to a for loop though such as:

Rich (BB code):
for(i = 0; i < 10; i++){
Delay_ms(100);
}
Which will still give you your 1sec delay.

GL.
 

THE_RB

Joined Feb 11, 2008
5,438
MikroC and MikroC PRO will generate Delay_ms() as inline code.

That means it will chew up some ROM if you call it multiple times, but one good side is that it is not limited to the number of mS. I often use Delay_ms(2000) etc to get a 2 second delay.

If you are going to call the same delay period a lot, just wrap it in your own function like this;
Rich (BB code):
void My_Delay_2sec(void)
{
  Delay_ms(2000);
}
As far as I know MikroC is not case sensitive on function names, but the newer MikroC PRO is case sensitive.

If you click the text cursor on the function name, then press F1 button then Mikro C (and PRO) will bring up the help file for that function.
 
Top