Demo of LCD modified to use interrupts not delays.

Dependencies:   mbed

Fork of LCD_nonblocking_demo by Oliver Broad

This is an experiment in controlling an LCD from callbacks independently of the main program loop. As it runs from callbacks it is necessary to check if the library is "busy", which is currently indicated by an integer called "busy".

Busy checking should be converted into a method so that the criteria for being "busy" can be changed without changing the API.

As this is rough I have not issued it as a library ... yet.

Also due to my inexperience using the repository manager this is currently listed as a fork of itself. Sorry.

Committer:
oliverb
Date:
Wed Nov 20 12:52:19 2013 +0000
Revision:
3:f18aa98bc9a8
Parent:
2:d87266912897
Moved classes out of main

Who changed what in which revision?

UserRevisionLine numberNew contents of line
oliverb 0:e1231949753e 1 // Hello World! for the TextLCD
oliverb 2:d87266912897 2 /*
oliverb 2:d87266912897 3 * Heavily modified LCD "Hello world"
oliverb 2:d87266912897 4 *
oliverb 2:d87266912897 5 * LCD Library has been merged into program for convenience of development, and
oliverb 2:d87266912897 6 * can be de-merged once its looking reliable
oliverb 2:d87266912897 7 * currently this gives good results with a small LCD and with a LCD emulation VFD
oliverb 2:d87266912897 8 * but is not reliable with a GU140x32-7806A graphic VFD
oliverb 2:d87266912897 9 *
oliverb 2:d87266912897 10 * Note E is set to 1 at end of cycle in an attempt to force a bug as display works fine
oliverb 2:d87266912897 11 * on first power-up but tends to corrupt after MBED manual reset. I am speculating that
oliverb 2:d87266912897 12 * something appears on MBED pins that the display "objects" to during a manual reset
oliverb 2:d87266912897 13 *
oliverb 2:d87266912897 14 */
oliverb 0:e1231949753e 15
oliverb 3:f18aa98bc9a8 16 #include "LCD_nonblocking.h"
oliverb 0:e1231949753e 17 DigitalOut Led1(LED1);
oliverb 0:e1231949753e 18 DigitalOut Led2(LED2);
oliverb 0:e1231949753e 19 DigitalOut Led3(LED3);
oliverb 0:e1231949753e 20 DigitalOut Led4(LED4);
oliverb 0:e1231949753e 21
oliverb 0:e1231949753e 22
oliverb 2:d87266912897 23 TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD20x4); // rs, e, d4-d7
oliverb 0:e1231949753e 24
oliverb 0:e1231949753e 25
oliverb 2:d87266912897 26 int main()
oliverb 2:d87266912897 27 {
oliverb 2:d87266912897 28 while(1) {
oliverb 2:d87266912897 29 Led1=1;
oliverb 2:d87266912897 30 lcd.init();
oliverb 2:d87266912897 31 Led2=1;
oliverb 2:d87266912897 32 Led1=0;
oliverb 2:d87266912897 33 while (lcd.busy) {}
oliverb 2:d87266912897 34 Led3=1;
oliverb 2:d87266912897 35 Led2=0;
oliverb 2:d87266912897 36 lcd.printf("Test String that goes over end of line!\n");
oliverb 2:d87266912897 37 Led4=1;
oliverb 2:d87266912897 38 Led3=0;
oliverb 2:d87266912897 39 while (lcd.busy) {}
oliverb 2:d87266912897 40 Led1=1;
oliverb 2:d87266912897 41 wait(1);
oliverb 2:d87266912897 42 // DigitalOut E(p17);
oliverb 2:d87266912897 43 // E=1; // try to break it
oliverb 2:d87266912897 44 }
oliverb 0:e1231949753e 45 }