something wrong with timeroverflow interruptions

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:

something wrong with timeroverflow interruptions

Post by ALOPEZ »

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?
Attachments
DUTYCYCLE TEST.fcfx
(6.61 KiB) Downloaded 327 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: something wrong with timeroverflow interruptions

Post by Benj »

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.

ALOPEZ
Posts: 27
Joined: Tue Nov 26, 2013 8:37 pm
Been thanked: 1 time
Contact:

Re: something wrong with timeroverflow interruptions

Post by ALOPEZ »

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.
Attachments
DUTYCYCLE TEST.fcfx
(5.88 KiB) Downloaded 303 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: something wrong with timeroverflow interruptions

Post by Benj »

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.

Post Reply