Hi Team,
Is there a way to stop writing to a lcd display. i have a 18f4560 running at 40Mhz clock i need a interrupt to run at 1us would be good. im using the interrupt to generate a start and stop pulse. i only write to display when time has finished.
Thanks
wayne
LCD
Moderator: Benj
- 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: LCD
Hi Wayne,
This is why it is not a good idea to control anything from inside an interrupt. Instead you should set flags in the interrupt and then test the flags in your main program.
A timer 2 interrupt on a PIC is normally the most configurable interrupt to give you a fixed frequency interrupt. 1us is probably too fast.
eg at 40 MHz there would only be 10 instructions between interrupts. This means that if your interrupt is 8 instructions then you have 2 spare instructions every microsecond for your main program. Go over 10 instructions in your interrupt routine and your main program code will never be executed.
Do you mean stop writing while inside a write macro? If so then the interrupt will automatically break out of what is currently happening, preform the interrupt and then continue with the LCD operations.Is there a way to stop writing to a lcd display.
This is why it is not a good idea to control anything from inside an interrupt. Instead you should set flags in the interrupt and then test the flags in your main program.
A timer 2 interrupt on a PIC is normally the most configurable interrupt to give you a fixed frequency interrupt. 1us is probably too fast.
eg at 40 MHz there would only be 10 instructions between interrupts. This means that if your interrupt is 8 instructions then you have 2 spare instructions every microsecond for your main program. Go over 10 instructions in your interrupt routine and your main program code will never be executed.
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