Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Revision 0:5dbeda619328, committed 2015-11-13
- Comitter:
- shaizeen
- Date:
- Fri Nov 13 02:03:19 2015 +0000
- Commit message:
- lcd custom
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lcd.cpp Fri Nov 13 02:03:19 2015 +0000
@@ -0,0 +1,49 @@
+// LCD.cpp File
+#include "lcd.h"// Define mbed objects
+
+
+ DigitalOut RS(p26) ;
+ DigitalOut E(p25) ;
+ BusOut data(p24, p23, p22, p21) ;
+
+ // Toggle enable function
+ void toggle_enable(void)
+ { E = 1 ;
+ wait(0.001) ;
+ E = 0 ;
+ wait(0.001) ;
+ }// Initialise LCD function
+ void LCD_init(void)
+ { wait(0.02) ;
+ RS = 0 ; E = 0 ;
+
+ // Function mode
+ data = 0x2 ;
+ toggle_enable( ) ;
+ data = 0x8 ;
+ toggle_enable( ) ;
+
+ // Display mode
+ data = 0x0 ;
+ toggle_enable( ) ;
+ data = 0xF ;
+ toggle_enable( ) ;
+
+ // Clear display
+ data = 0x0 ;
+ toggle_enable( ) ;
+ data = 0x1 ;
+ toggle_enable( ) ;
+
+ }
+
+ // Display function
+ void display_to_LCD(char value )
+ {
+ RS = 1;// display character
+ data = value >> 4 ; // Upper 4
+ toggle_enable( ) ;
+ data = value & 0x0F ; // Lower 4
+ toggle_enable( ) ;
+
+ }
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lcd.h Fri Nov 13 02:03:19 2015 +0000 @@ -0,0 +1,12 @@ +// LCD.h file +#ifndef LCD_H +#define LCD_H +#include "mbed.h" + + +void display_to_LCD(char value) ; //function to display characters on the LCD +void toggle_enable(void) ; //function to toggle the enable bit +void LCD_init(void) ; //function to initialise the LCD + + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Nov 13 02:03:19 2015 +0000
@@ -0,0 +1,12 @@
+
+#include "lcd.h"
+int main( )
+ { LCD_init( );
+ display_to_LCD(0x48) ; // „H‟
+ display_to_LCD(0x45) ; // „E‟
+ display_to_LCD(0x4C) ; // „L‟
+ display_to_LCD(0x4C) ; // „L‟
+ display_to_LCD(0x4F) ; // „O‟
+
+
+ }
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Nov 13 02:03:19 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11 \ No newline at end of file