
Display LCD
Dependencies: mbed
Revision 0:c48b6fa0aea1, committed 2016-10-24
- Comitter:
- Mattinico
- Date:
- Mon Oct 24 18:07:30 2016 +0000
- Commit message:
- k
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD.cpp Mon Oct 24 18:07:30 2016 +0000 @@ -0,0 +1,43 @@ +#include "LCD.h" +DigitalOut RS(D12); +DigitalOut E(D11); +BusOut data(D5,D4,D3,D2); +void toggle_enable(void){ + E=1; + wait(0.001); + E=0; + wait(0.001); +} +void LCD_init(void){ + wait(0.02); + RS=0; + E=0; + data=0x2; + toggle_enable(); + data=0x8; + toggle_enable(); + data=0x0; + toggle_enable(); + data=0xF; + toggle_enable(); + data=0x0; + toggle_enable(); + data=0x1, + toggle_enable(); + } + void display_to_LCD(char value){ + RS=1; + data=value>>4; + toggle_enable(); + data=value; + toggle_enable(); +} +void set_location(char location){ + data=(location|0x80)>>4; + toggle_enable(); + data=location&0x0F; + toggle_enable(); + } + + + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD.h Mon Oct 24 18:07:30 2016 +0000 @@ -0,0 +1,8 @@ +#ifndef LCD_H +#define LCD_H +#include "mbed.h" +void toggle_enable(void); +void LCD_init(void); +void display_to_LCD(char value); +void set_location(char location); +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Oct 24 18:07:30 2016 +0000 @@ -0,0 +1,21 @@ +#include "LCD.h" + +int main() { + +char loc=0x40; +LCD_init(); +display_to_LCD(0x46); +display_to_LCD(0x6F); +display_to_LCD(0x72); +display_to_LCD(0x7A); +display_to_LCD(0x61); +set_location(loc); +display_to_LCD(0x4E); +display_to_LCD(0x61); +display_to_LCD(0x70); +display_to_LCD(0x6F); +display_to_LCD(0x6C); +display_to_LCD(0x69); + + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Oct 24 18:07:30 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3 \ No newline at end of file