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
Delay function and interruption TMR0 crash
Moderator: Benj
Forum rules
Only bug reports will be considered here. General questions should not be posted in this forum.
Only bug reports will be considered here. General questions should not be posted in this forum.
Delay function and interruption TMR0 crash
- Attachments
-
- DUTYCYCLE TEST.fcfx
- (10 KiB) Downloaded 369 times
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel