DIGITAL CLOCK USING CLOUDX CloudX

  • img
Project Details

PROJECT DETAILS 

this project involves interfacing cloudx microcontroller with a RTC(Real time clock) module DS1302 
which is particularly useful in applications that involves monitoring and tracking time and days of the week,month and year.

CIRCUIT DIAGRAM

PROJECT MATERIALS 

DS1302 RTC MODULE

CLOUDX  microcontroller and softcard

LCD  display module

bread board

male to male connecting cables

 

CODE
 


#include <CloudX/M633.h>
#include <CloudX/LCD.h>
#include <CloudX/DS1302.h>

byte minutes = 0, seconds = 0, hours = 0;
byte day = 0, month = 0, year = 0, date = 0;
// portMode(3, 0x00);

char time[9] = {'0', '0', ':', '0', '0', ':', '0', '0', '\0'};
char Date[9] = {'0', '0', '/', '0', '0', '/', '0', '0', '\0'};

setup(){

DS1302_init(14, 15, 16); //DAT, CLK, CE
LCD_setting(1, 2, 3, 4, 5, 6); //RS, EN, D4, D5, D6, D7
LCD_cmd(clear);

LCD_writeText(1, 1, "Time:");
LCD_writeText(2, 1, "Date:");

//--------------------------------------------------------------------------------
// Method I of setting Date and Time
//--------------------------------------------------------------------------------
DateTime_write(6, 9, 18, 27, 23, 30, 0); //day(1-7),month(1-12),year(0-99),
//date(1-31),hr(0-23),min(0-59),sec(0-59)

loop(){

Time_read(&hours, &minutes, &seconds);
Date_read(&day, &month, &year, &date);

time[0] = BCD2UpperChar(hours);
time[1] = BCD2LowerChar(hours);
time[3] = BCD2UpperChar(minutes);
time[4] = BCD2LowerChar(minutes);
time[6] = BCD2UpperChar(seconds);
time[7] = BCD2LowerChar(seconds);

Date[0] = BCD2UpperChar(date);
Date[1] = BCD2LowerChar(date);
Date[3] = BCD2UpperChar(month);
Date[4] = BCD2LowerChar(month);
Date[6] = BCD2UpperChar(year);
Date[7] = BCD2LowerChar(year);


LCD_writeText(1, 7, time);
LCD_writeText(2, 7, Date);

}
}

 

EXPLANATION

from the above you need to understand the circuit diagram , the circuit consists of the screen , the ds1302 rtc clock module and the major cloudx board , open your cloudx IDE , copy and paste the code run it and upload it to your cloudx board , for details of these processes checkout this https://cloudx.ng/project/how-to-install-cloudx-1546254216ish463n393s720gegni7ttti
 

then https://cloudx.ng/project/a-complete-guide-through-building-your-first-ever-project-on-cloudx-154911964986ti9in163agh3738s

the ds1302 module sends the current time and date to the cloudx board and the cloudx microcontroller reads such values and displays it on the LCD screen.

Share this with friends