Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Hitech C Delay routine problem in interrupt service routine..

Status
Not open for further replies.

wonjeongpark

New Member
Hello everyone!!

I have a problem using the hi tech C compiler..

the problem as the title...

delay routine is work well at main routine nevertheless,

generate compile error at the interrupt service routine.

why occurrence compile error in the interrupt service routine?

this is compile error message:

Error [472] ; . non-reentrant function "_DelayMs" appears in multiple call graphs: rooted at "_isr" and "_main"

delay function is HI TECH C sample program.

please answer me...

Hello everyone!!

I have a problem using the hi tech C compiler..

the problem as the title...

delay routine is work well at main routine nevertheless,

generate compile error at the interrupt service routine.

why occurrence compile error in the interrupt service routine?

this is compile error message:

Error [472] ; . non-reentrant function "_DelayMs" appears in multiple call graphs: rooted at "_isr" and "_main"

delay function is HI TECH C sample program.

please answer me...

thanks
 
Last edited:
The problem is that the DelayMs function is non-reentrant, like the error says. What this means is that if the program attempts to enter DelayMs (from the interrupt) while it is already in DelayMs (from the main loop), then the function will fail to execute properly. The compiler is protecting you from a bug.

I think if you create a duplicate of the function and use the duplicate in the interrupt and no where else that it might work. I've seen that error you're seeing right now, but I've never actually tried to fix it because I try not to call functions from interrupts... but obviously I do sometimes because I wouldn't have otherwise seen the error :D
 
In general using significant delays inside an ISR is not a good idea. a mS is significant.

You should be able to setup a timer to interrupt when the "delay time" is over then exit the ISR. When the timer interrupts ISR code can continue with what it was doing.
 
I agree, and almost said something, but we don't know the full situation. He might be just tryin something out or maybe running off of a 32 KHz clock. Setting up a timer for a 1 mS delay might take more time than just waiting a mS.
 
You are correct but:

When you hear hoofbeats behind you, don't expect to see a zebra,

I used to start many posts by asking the OP not to be offended if they already knew what I was about to tell them. But not knowing the full situation will stop few people from posting based on speculation. Requesting additional information from the OP is often a waste of time in that the next six posts will provide speculative answers and the request for info often goes unanswered.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top