Question
Language C++ using a mbed LPC1768 In this lab, you will re-design the digital clock in Lab 6 with the capability of digital thermometer upon
Language C++ using a mbed LPC1768
In this lab, you will re-design the digital clock in Lab 6 with the capability of digital thermometer upon the push of a push button.Design a way of using the pushbutton to trigger an interrupt to your system. Your system, upon receiving this interrupt, responds by reading and displaying the temperature in Fahrenheit degrees on the LCD display in the format of xxx.x. The system must resume displaying the digital clock.
Based on the hardware you designed, choose an interrupt/timer tool from mbed to update the LCD display with the digital clock HH:MM:SS every second with the correct time of second, minute and hour. You must NOT have any code for counting or displaying the clock display with hour, minute or second in the main() function other than setting the clock display to 00:00:00 at start up. This means, you should use a timing tool (interrupt or timer) to update the clock display rather than using wait(1) for waiting for 1 second as we did in Lab 6. Whenever the user pushes on the push button and releases it, the system will respond to it by measuring the current temperature and displaying the temperature to the LCD for approximately 1 second. Then the system shall resume the display of the current digital time. Keep in mind, the clock should continue counting as if the temperature reading was never done instead of restarting from 00:00:00.
This is the code I used for my LCD display. I need help on the circuit and code design...
#include "mbed.h" #include "TextLCD.h"
TextLCD lcd(p19, p20, p21, p22, p23, p24);
DigitalIn reset_button(); // to reset LCD
int hours, minutes, seconds;
int main() {
hours=0;
minutes=0;
seconds=0;
while(1)
{
if(reset_button==0) // time will reset
{
hours=0;
minutes=0;
seconds=0;
}
seconds++; //second increases after one second
if(seconds==60)
{ seconds=0;
minutes++; // minute increases after 60 seconds
}
if(minutes==60)
{ minutes=0;
hours++; // hour increases every 60 minutes
}
if(hours==24) // when it reaches 24hrs, it will go back to 00:00:00
{ hours=0; minutes=0; seconds=0;
}
lcd.locate(0,0); // location of column and row of where I want to have the clock display
lcd.printf(" %02d : %02d : %02d ", hours, minutes, seconds); //to printing the values in lcd // show time, use 2 positions per field, show leading zeros
wait(1);
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started