Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I want to make a digital alarm clock project with 1 6 F 8 7 7 A micro controller with CCS C but I have
I want to make a digital alarm clock project with FA micro controller with CCS C but I have an error in code parts I change the time but I can't change the alarm time code part is below LCD module connections
#define LCDRSPIN PINC
#define LCDRWPIN PINC
#define LCDENABLEPIN PINC
#define LCDDATA PINC
#define LCDDATA PINC
#define LCDDATA PINC
#define LCDDATA PINC
End LCD module connections
Keypad connections
#define ROWA PIND
#define ROWB PIND
#define ROWC PIND
#define ROWD PIND
#define COL PIND
#define COL PIND
#define COL PIND
#define SETA PINB
#define SETB PINB
#define SETC PINB
#define SETD PINB
#define ALARMPIN PINA
#include FAh
#use delaycrystal
#include
Alarm hour and minute
int alarmhour ;
int alarmminute ;
Function prototypes
void showtime;
void adjusttime;
void adjustalarm;
void checkalarm;
Hour, minute, and second values
int hour ;
int minute ;
int second ;
void main
lcdinit; Initialize the LCD module
whileTRUE
lcdputcf; Clear the LCD screen
lcdgotoxy; Go to the th column of the st row
lcdputcTIME;
Call the showtime function to display the time
showtime;
Read keypad inputs to adjust the time and call the adjusttime function
adjusttime;
delayms; Wait for milliseconds
Function to display the time
void showtime
Update hour, minute, and second values
second;
ifsecond
second ;
minute;
ifminute
minute ;
hour;
ifhour
hour ;
Print the time on the upper row of the LCD screen
lcdgotoxy;
printflcdputc, "TIME: d:d:d hour, minute, second;
Print the alarm time on the lower row of the LCD screen
lcdgotoxy;
printflcdputc, "ALARM: d:d alarmhour, alarmminute;
Function to read keypad inputs and adjust the time
void adjusttime
Activate each column one by one and check the status of keys in each row
outputhighCOL;
outputlowCOL;
outputlowCOL;
ifinputROWA
Increment hour if key is pressed
hour;
ifhour
hour ;
delayms; Wait for stabilization of keypad integration
ifinputROWB
Increment minute if key is pressed
minute;
ifminute
minute ;
delayms; Wait for stabilization of keypad integration
ifinputROWC
Decrement hour if key is pressed
hour;
ifhour
hour ;
delayms; Wait for stabilization of keypad integration
ifinputROWD
Decrement minute if key is pressed
minute;
ifminute
minute ;
delayms; Wait for stabilization of keypad integration
Function to read keypad inputs and adjust the alarm time
void adjustalarm
int row, col;
char key;
Read each column in turn
for col ; col ; col
Activate a specific column
outputlowCOL col;
Check each row
for row ; row ; row
Check if the key is pressed
if inputROWA row
Find the number of the pressed key
key row col ;
Adjust alarm hour or minute based on the key pressed
if key
alarmhour key;
else if key
alarmhour ;
else if key
alarmminute ;
else if key
alarmminute ;
Wait to prevent multiple detections of the same key
delayms;
Break the loop to check the entire keypad
row ;
col ;
Deactivate the column
outputhighCOL col;
Function to check the alarm
void checkalarm
Activate the alarm if hour and minute match the alarm time
ifhour alarmhour && minute alarmminute
Activate the alarm if hour and minute match the alarm time
ifhour alarmhour && minute alarmminute
Activate the buzzer
outputhighALARMPIN; can you help me I guess my keypad code is not true please dont use chatgpt only experts give solution
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