Project 11
Project 11
h>
extern void LCDini(void);
void display_time(void) {
// Display hours
LCDMEM[9] = lcd_number_map[hours / 10]; // Tens place of hours
LCDMEM[5] = lcd_number_map[hours % 10]; // Units place of hours
// Display minutes
LCDMEM[3] = lcd_number_map[minutes / 10]; // Tens place of minutes
LCDMEM[18] = lcd_number_map[minutes % 10];// Units place of minutes
// Display seconds
LCDMEM[14] = lcd_number_map[seconds / 10]; // Tens place of seconds
LCDMEM[7] = lcd_number_map[seconds % 10]; // Units place of seconds
}
void main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop Watchdog timer
PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO high-impedance mode
LCDini(); // Initialize the LCD
while (1) {
__low_power_mode_3(); // Enter low-power mode, wait for interrupts
}
}
void LCDini(void) {
// LCD initialization as provided in the previous code
LCDCPCTL0 = 0xFFFF;
LCDCPCTL1 = 0xFC3F;
LCDCPCTL2 = 0x00FF;
// Initialize LCD_Clock
LCDCCTL0 = LCDDIV__1 | LCDPRE__16 | LCD4MUX | LCDLP;