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
main.cpp
- Committer:
- chills
- Date:
- 2017-12-27
- Revision:
- 3:6ee7c8ce0b7a
- Parent:
- 2:ed06e716cca2
- Child:
- 4:2759062f4264
File content as of revision 3:6ee7c8ce0b7a:
#include "mbed.h" #include <string> 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 Function_Set(); void Display_Off(); void Display_Clear(); void Entry_Mode_Set(); void Display_On(); void DDRAM_Address(int Address); void Write_Data(string Letter); void Write_String(string Word); void Initialise(); int main() { DB.output(); Initialise(); DDRAM_Address(0x40); Write_String("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); } void clock_in(){E = 1; wait(0.001); E = 0; wait(0.001); E = 1;} 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 = 0x0F; clock_in();} void Initialise(){ 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); } void DDRAM_Address(int Address){RS = 0; RW = 0; DB = 0x80 + Address; clock_in();} void Write_Data(string Letter){ int ASCII_Converted[32]; for (int i = 0; i < Letter.length(); i++) { ASCII_Converted[i] = Letter.at(i); } RS = 1; RW = 0; DB = ASCII_Converted[0]; clock_in(); } void Write_String(string Word){ int ASCII_Converted; for (int i = 0; i < Word.length(); i++) { ASCII_Converted = Word.at(i); RS = 1; RW = 0; DB = ASCII_Converted; clock_in(); } }