Hello Benj,
I have some problems(hardware, simulations runs perfect) with programas that manage lcd and timeroverflow interruptions.
Please find attach this program. when i activate interruption, interruption works ok, i can see D0 in the osciloscope. But lcd doens't print right in the hardware.
when i deactivated interrupcion LCD hardware works perfect.
what it can be?
something wrong with timeroverflow interruptions
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.
something wrong with timeroverflow interruptions
- Attachments
-
- DUTYCYCLE TEST.fcfx
- (6.61 KiB) Downloaded 379 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: something wrong with timeroverflow interruptions
Hello,
It sounds like the interrupt may be messing up the bit banged signals to the LCD though this seems odd.
One thing to try would be to remove the 1ms delay from the timer interrupt and instead set a variable. Check the variable as part of your main loop and if it is set then set the pin, wait the millisecond and clear it again. This way the toggling pin cannot effect the LCD operations.
It sounds like the interrupt may be messing up the bit banged signals to the LCD though this seems odd.
One thing to try would be to remove the 1ms delay from the timer interrupt and instead set a variable. Check the variable as part of your main loop and if it is set then set the pin, wait the millisecond and clear it again. This way the toggling pin cannot effect the LCD operations.
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
Re: something wrong with timeroverflow interruptions
Hello Benj,
Seems to my that you can't use delay box in the main program and in the interruption.
PLease find attach this program. You can't see if there is just one delay (in interruption or main program) program works ok. but if you try to use delay in program and interruption, seems delay sub rutine get broke.
should be nice have the possibility to use delay fuction in program and interruption.
thanks for your fast answer.
Seems to my that you can't use delay box in the main program and in the interruption.
PLease find attach this program. You can't see if there is just one delay (in interruption or main program) program works ok. but if you try to use delay in program and interruption, seems delay sub rutine get broke.
should be nice have the possibility to use delay fuction in program and interruption.
thanks for your fast answer.
- Attachments
-
- DUTYCYCLE TEST.fcfx
- (5.88 KiB) Downloaded 350 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: something wrong with timeroverflow interruptions
Aha yes there is millisecond delays used by the LCD so I suppose if you go back into the delay function via an interrupt while the main loop is inside a delay then the LCD will likely get corrupted.
Delays inside an interrupt are not recommended. What about you have an interrupt, set the pin then re-enable the interrupt for 1ms time and then when you interrupt again switch the output pin back off. This way you don't have to use delays and your interrupt code will be a lot more efficient.
Delays inside an interrupt are not recommended. What about you have an interrupt, set the pin then re-enable the interrupt for 1ms time and then when you interrupt again switch the output pin back off. This way you don't have to use delays and your interrupt code will be a lot more efficient.
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