Page 1 of 1

Delay function and interruption TMR0 crash

Posted: Tue Feb 04, 2014 10:46 am
by ALOPEZ
Hello,
There is an issue with delay fuction and interruptions.
please find attach this program, works well on simulation, but in hardware stop in delay 100ms.
if you take out 100ms delay in main program works well.
I hope you can fix, because delay fuction is very useful.
thanks

Re: Delay function and interruption TMR0 crash

Posted: Tue Feb 04, 2014 12:30 pm
by Benj
Hello,

The LCD routines your calling as part of the interrupt will be calling the millisecond delay function which will then conflict with the ms delay in main. It is not recommended to do slow things like LCD writes as part of an interrupt. Is there any way you can move the LCD code into the main loop? Otherwise you might be able to use multiple microsecond delays in your program to clock up the 100ms delay you need.