Question: Write a C language program that implements a 12 hour real time clock using the LCD display unit on the MSP430FG4618 experimenter board. The clock
Write a C language program that implements a 12 hour real time clock using the LCD display unit on the MSP430FG4618 experimenter board. The clock format should be:
hours : minutes : seconds
10 : 30 : 23
Every second, the LCD display should be updated with the new time. The LCD display should be called from the timer interrupt service function to update the various seven segment displays based upon a set of time variables.
LCD display has seven segments and two colons are turned on as well:
_ _ _ _ _ _ _
1 0:3 0:2 3
Here is the code format:
#include "msp430fg4618.h"
#include "intrinsics.h"
#include "stdio.h"
__interrupt void Time_ISR(void);
int main(void){
WDTCTL=WDTPW+WDTHOLD;
P2DIR |= LED;
P2OUT = LED;
TACCTL0 = CCIE;
TA0CTL= MC_1 | ID_3 | TASSEL_1 | TACLR;
TACCR0= 0x1000; //every one second
__enable_interrupt();
for(;;){
// add main body of code here
}
}
#pragma vector= TIMERA0_VECTOR;
__interrupt void Timer_ISR(void){
P2OUT ^=LED;
}
PSEUDOCODE to increment the time variables:
su= second units
st= second tenths
mu= minute units
mt= minute tenths
h= hours
hu= hours units
ht= hour tenths
su++;
if (su==10){
su=0;
mu++
}
if (st==6){
st=0;
mu++
}
if(mu==10){
mu=0;
mt++
}
if(mu==6){
mt=0;
h++;
}
if(h==13){
h=1;
}
hu=h;
ht=0;
if(h==10){
hu=0;
ht=1;
}
if(h==1){
hu=1;
ht=1;
}
if(h==12){
hu=2;
ht=1;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
