Advanced Micro Processor Experiments SEM-6 Marwadi Education Foundation Rajkot

Dependencies:   TextLCD mbed

Fork of MEFGI by ravi butani

Revision:
0:c7aaecd69812
Child:
1:d18350d02dd3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Apr 12 06:08:15 2016 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+#include "TextLCD.h"
+TextLCD lcd(D2, D3, D4, D5, D6, D7); // LCD PIN => RS, EN, Data4, Data5, Data6, Data7
+
+int main()
+{
+    int i=0;
+    float f=0;
+    lcd.cls(); // Clear LCD
+    lcd.locate(0,0); // cursor on Col=0, Raw=0
+    lcd.printf("Experiment - 4"); // print startup message on LCD first Raw
+    lcd.locate(0,1); // cursor on Col=0, Raw=1
+    lcd.printf("LCD Interfacing"); // print startup message on LCD second Raw
+    wait(3.0); // wait 3 second to show startup message
+    while(1) // loop forever
+    {
+    lcd.cls(); // Clear LCD
+    lcd.locate(0,0); // cursor on Col=0, Raw=0
+    lcd.printf("Int   i = %d",i); // print value of i in first line of LCD
+    lcd.locate(0,1); // cursor on Col=0, Raw=1
+    lcd.printf("Float f = %0.2f",f); // print value of f with resolution of two decimal point in second line of LCD
+    i=i+1; // update i
+    f=f+0.01; // update f
+    wait(1.0); // Wait for 1 second
+
+    }
+    
+}