Delay function and interruption TMR0 crash

Please add any bug reports that require discussion here

Moderator: Benj

Forum rules
Only bug reports will be considered here. General questions should not be posted in this forum.
Post Reply
ALOPEZ
Posts: 27
Joined: Tue Nov 26, 2013 8:37 pm
Been thanked: 1 time
Contact:

Delay function and interruption TMR0 crash

Post 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
Attachments
DUTYCYCLE TEST.fcfx
(10 KiB) Downloaded 308 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Delay function and interruption TMR0 crash

Post 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.

Post Reply