2. The C program in Figure 1 is to show the elapsed time on LCD display in seconds. The program uses a Ticker with a period of 10ms to control system timing. (1) Modify the program such that it uses a time base of 1 ms to drive the clock. (2) Modify the program in such a way displays elapsed time in hours, minutes and seconds.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question
#include "mbed.h"
#include "C12832_lcd.h"
int counter = 0, seconds = 0;
int flag = 0;
C12832_LCD lcd;
Ticker tick;
void T1_isr ()
{
counter++;
if (counter >= 100)
}
seconds++;
counter = 0;
flag = 1;
int main(){
// clock tick
//1 second has passed?
while(1) {
// Yes increment seconds
// reset counter
// set flag to update display
tick.attach_us(&T1_isr, 10000);
lcd.cls();
lcd.locate(0,0);
lcd.printf("Elapsed Time Monitor"); //print header
while (flag == 0);
lcd.locate(0,15);
lcd.printf("Elapsed Seconds: %d", seconds);
flag = 0; //reset flag
}
Figure 1
// wait for new data
Transcribed Image Text:#include "mbed.h" #include "C12832_lcd.h" int counter = 0, seconds = 0; int flag = 0; C12832_LCD lcd; Ticker tick; void T1_isr () { counter++; if (counter >= 100) } seconds++; counter = 0; flag = 1; int main(){ // clock tick //1 second has passed? while(1) { // Yes increment seconds // reset counter // set flag to update display tick.attach_us(&T1_isr, 10000); lcd.cls(); lcd.locate(0,0); lcd.printf("Elapsed Time Monitor"); //print header while (flag == 0); lcd.locate(0,15); lcd.printf("Elapsed Seconds: %d", seconds); flag = 0; //reset flag } Figure 1 // wait for new data
2. The C program in Figure 1 is to show the elapsed time on LCD display in seconds. The
program uses a Ticker with a period of 10ms to control system timing.
(1) Modify the program such that it uses a time base of 1 ms to drive the clock.
(2) Modify the program in such a way displays elapsed time in hours, minutes and seconds.
Transcribed Image Text:2. The C program in Figure 1 is to show the elapsed time on LCD display in seconds. The program uses a Ticker with a period of 10ms to control system timing. (1) Modify the program such that it uses a time base of 1 ms to drive the clock. (2) Modify the program in such a way displays elapsed time in hours, minutes and seconds.
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Operators
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education