Do a functional program in C language (please don\'t use C++) for CCS Compiler,
ID: 3842038 • Letter: D
Question
Do a functional program in C language (please don't use C++) for CCS Compiler, PIC 18F4550
The program is not for simulation. I am going to use the PIC in a real project.
The program is for a smart (domotic) house. With the basic functions of detecting temperature, motion sensors control, lights control, open and close doors, alarm activation, passwords to activate or deactivate the alarm (using a 4x4 keyboard), etc. Everything showing related messages in a 2x16 LCD screen.
Please, give me a full explanation of the program with comments. Also, please give me the schematic diagram connections.
Explanation / Answer
I have designed and developed the program for detecting temperature, alarm activation and all.I have added the comments for each part of code and attached the final output of the program.
Let me explain you in step-by-step manner:-
Step-1:
The initial part is create a detecter using the temperarture by motion sensors control which is used by the lights control.
Step-2:
The next step is to use the open and close doors which is specified by the alarm activation using the 4x4 keyboard.
Step-3:
The final step is to use the password protection to activate and deactivate the alarm by showing the related messages into 2x16 LCD Screens.
C Program:-
// This is the header files in C program for embedding the methods and properties of each class
#define CLOCK_H
// Created a structure
typedef alarmSimulator
{
int alarmHours;
int alarmMinutes;
int alarmSeconds;
} alarmDataType;
typedef alarmSimulator
{
alarmDataType alarmTime;
alarmDataType timeMethodAlarm;
int alarmMutex;
pthread_mutex_t simulatorMutex;
void alarm_meth_Type(void)
{
alarmClock.alarmTime.alarmHours = 0;
alarmClock.alarmTime.alarmMinutes = 0;
alarmClock.alarmTime.alarmSeconds = 0;
alarmClock.timeMethodAlarm.alarmHours = 0;
alarmClock.timeMethodAlarm.alarmMinutes = 0;
alarmClock.timeMethodAlarm.alarmSeconds = 0;
alarmClock.alarmMutex = 0;
pthread_mutex_init(&alarmClock.simulatorMutex, NULL);
}
void alarmTimeSet(int alarmHours, int alarmMinutes, int alarmSeconds)
{
pthread_mutex_lock(&alarmClock.simulatorMutex);
alarmClock.alarmTime.alarmHours = alarmHours;
alarmClock.alarmTime.alarmMinutes = alarmMinutes;
alarmClock.alarmTime.alarmSeconds = alarmSeconds;
pthread_mutex_unlock(&alarmClock.simulatorMutex);
}
void alarm_meth_Type(void);
void alarmTimeSet(int alarmHours, int alarmMinutes, int alarmSeconds);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.