![](/media/cache/profiles/fbfdab7e3983009e7d488d946a8de066.jpg.50x50_q85.jpg)
LCD from base
Revision 0:0b293534b6b1, committed 2013-02-18
- Comitter:
- HarishMekali
- Date:
- Mon Feb 18 07:09:47 2013 +0000
- Commit message:
- LCD by writing our lib
Changed in this revision
diff -r 000000000000 -r 0b293534b6b1 LCD.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD.cpp Mon Feb 18 07:09:47 2013 +0000 @@ -0,0 +1,41 @@ +// LCD.cpp file +#include "LCD.h" +//define mbed objects +DigitalOut RS(p19); +DigitalOut E(p20); +BusOut data(p21, p22, p23, p24); +//toggle enable function +void toggle_enable(void) { +E=1; +wait(0.001); +E=0; +wait(0.001); +} +void LCD_init(void) { //initialize LCD function +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; +data=value>>4; +toggle_enable(); +data=value&0x0F; +toggle_enable(); +} \ No newline at end of file
diff -r 000000000000 -r 0b293534b6b1 LCD.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD.h Mon Feb 18 07:09:47 2013 +0000 @@ -0,0 +1,8 @@ +// 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 \ No newline at end of file
diff -r 000000000000 -r 0b293534b6b1 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Feb 18 07:09:47 2013 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" +#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’ +display_to_LCD(0x20); // ‘ ’ +display_to_LCD(0x46); // ‘F’ +display_to_LCD(0x41); // ‘A’ +display_to_LCD(0x43); // ‘C’ +display_to_LCD(0x55); // ‘U’ +display_to_LCD(0x4C); // ‘L’ +display_to_LCD(0x54); // ‘T’ +display_to_LCD(0x59); // ‘Y’ +display_to_LCD(0x21); // ‘!’ +} \ No newline at end of file
diff -r 000000000000 -r 0b293534b6b1 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Feb 18 07:09:47 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/0954ebd79f59 \ No newline at end of file