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
Diff: main.cpp
- Revision:
- 0:87888ca85258
- Child:
- 1:23bf1845cc2f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Dec 27 15:10:44 2017 +0000 @@ -0,0 +1,79 @@ +#include "mbed.h" + +DigitalOut myled(LED1); + +DigitalOut RS(D9); +DigitalOut RW(D4); +DigitalOut E(D8); +BusInOut DB(A0, A1, A2, A3, D7, D6, D3, D1); //LSB First + +void clock_in(); +void first_init_command(); +void Function_Set(); +void Display_Off(); +void Display_Clear(); +void Entry_Mode_Set(); +void Display_On(); +void DDRAM_Address(int Address); +void Write_Data(int Letter); + +int main() { + + DB.output(); + first_init_command(); + wait(0.005); + first_init_command(); + wait(0.005); + first_init_command(); + wait(0.020); + Function_Set(); + wait(0.020); + Display_Off(); + wait(0.020); + Display_Clear(); + wait(0.020); + Entry_Mode_Set(); + wait(0.020); + Display_On(); + wait(0.020); + DDRAM_Address(0); + wait(0.020); + Write_Data(0x41); + +} + +void clock_in(){ + E = 1; wait(0.01); E = 0; wait(0.01); E = 1; +} + +void first_init_command(){ + RS = 0; RW = 0; DB = 0x30; clock_in(); +} + +void Function_Set(){ + RS = 0; RW = 0; DB = 0x3C; clock_in(); +} + +void Display_Off(){ + RS = 0; RW = 0; DB = 0x08; clock_in(); +} + +void Display_Clear(){ + RS = 0; RW = 0; DB = 0x01; clock_in(); +} + +void Entry_Mode_Set(){ + RS = 0; RW = 0; DB = 0x06; clock_in(); +} + +void Display_On(){ + RS = 0; RW = 0; DB = 0x0E; clock_in(); +} + +void DDRAM_Address(int Address){ + RS = 0; RW = 0; DB = 0x80 + Address; clock_in(); +} + +void Write_Data(int Letter){ + RS = 1; RW = 0; DB = Letter; clock_in(); +}