Professional Documents
Culture Documents
Embedded System Design
Embedded System Design
Embedded System Design
Submitted By
21BLC1603 – DARSHNI B
Submitted To
Dr. SOFANA REKA
DATE: 21/02/2024
Date: 21/02/2024
Software Required: ARM Keil Studio (Mbed Online Compiler), Tera Term
Hardware Required: Micro USB cable, NUCLEO64-STM32L152 Board, LEDs, Jumper Wires (F-F, M-F
and M-M), Breadboard, Potentiometer(s), LCD
Procedure:
1. Go to ARM Keil Studio (https://studio.keil.arm.com) and log in
2. Select File → New → Mbed Project
3. Click the Example project drop-down list and select “mbed2-example-blinky”
PROGRAM:
Lab Task 1
#include "mbed.h"
#include "TextLCD.h"
TextLCD lcd(PC_0,PC_1,PB_0,PA_4, PA_1, PA_0); // rs, e, d4-d7
int main()
{
lcd.locate(3,0);
lcd.printf("21BLC1603\n");
lcd.locate(0,1);
lcd.printf("DARSHNI\n");
}
Output:
INFERENCE:
From the program, we understood how to send data to each row of LCD.
PROGRAM:
Lab Task 2
1
#include "mbed.h"
#include "TextLCD.h"
TextLCD lcd(PC_0,PC_1,PB_0,PA_4, PA_1, PA_0); // rs, e, d4-d7
int main()
{
int a=0;
lcd.cls();
while (1) {
lcd.locate(5, 1);
lcd.printf("%d", a);
wait(1);
a++;
}
}
Output:
INFERENCE:
From the program, we understood how to repeatedly update a value and continuously display it in
LCD.
PROGRAM:
Lab Task 2
#include "mbed.h"
#include "TextLCD.h"
TextLCD lcd(PC_0,PC_1,PB_0,PA_4,PA_1,PA_0);
Serial pc(USBTX,USBRX);
Output:
INFERENCE:
From the program, we implemented input from Tera Term and to display the output on the LCD.
Lab Task 3:
PROGRAM:
Task 3
#include "mbed.h"
#include "TextLCD.h"
AnalogIn ain(PC_5);
TextLCD lcd(PC_0,PC_1,PB_0,PA_4,PA_1,PA_0); // rs,e,d4-d7
int main()
Output:
Fig.5: Changing
potentiometer to less value
INFERENCE:
From the program, we successfully learnt to read the output of a potentiometer and display the voltage
on LCD.
CHALLENGING TASK :
Write a program to design a automatic room temperature control system to monitor the room temperature
using LM35 sensor and display its value on LCD display. Whenever the room temperature crosses 32°C
the system must switch ON the Fan (DC motor) to control the room temperature. Once the temperature
goes below 32°C Fan must be switch OFF automatically. Assume LCD operates in 4-bit with EN and RS
active state. Design and verify this logic on Nucleo-152RE board using online Keil Studio platform.
CODE:
#include "mbed.h"
#include "TextLCD.h"
AnalogIn ain(PC_3);
TextLCD lcd(PC_0,PC_1,PB_0,PA_4,PA_1,PA_0); // rs,e,d4-d7
DigitalOut FAN(PC_8);
int main()
{
while(1) {
float sensorvalue = ain;
float vout = sensorvalue*50;
float tempc=vout*100;
lcd.cls();
lcd.locate(3,0);
lcd.printf("Temp = %0.2f",tempc);
if(tempc > 32.00){
}
Output Verification:
INFERENCE :
Thus automatic room temperature control system,
RESULT:
TASK 1:
Displayed name and registration number on the LCD display.
TASK 2:
Repeatedly updated the value on LCD display
TASK 3:
TASK 4: