Advanced Micro Processor Experiments SEM-6 Marwadi Education Foundation Rajkot

Dependencies:   TextLCD mbed

main.cpp

Committer:
rx5
Date:
2016-04-12
Revision:
0:c7aaecd69812

File content as of revision 0:c7aaecd69812:

#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

    }
    
}