10:43 AM
C++ programming code for Digital Calendar embedded based project

The title of the project is DIGITAL CALENDAR which is an embedded based project. An embedded project is a combination of hardware and software. Microprocessors and micro-controllers are widely used in such embedded system products. Each embedded system is unique and highly customized to the application at hand. The main basics that includes in embedded programming are either assembly programming or it may be high level languages such as C,C++ or Embedded C. This project ³DIGITAL CALENDAR´ using micro controller is an advanced digital calendar, which displays the Seconds, Minutes, Hours, Date, Day, month over the LCD display. It has the advantage of setting these features. It has an 8-bit micro-controller which runs on the program embedded in ROM. 

Source Coding

#include<conio.h>

#include<stdio.h>

 int day(int m1,int y1)

{

  int d;

  if(m1==1 || m1==3 || m1==5 || m1==7 || m1==8 || m1==10 || m1==12)

                                 d=31;

  else if(m1==4 || m1==6 || m1==9 || m1==11)

                                 d=30;

  else if((y1%100!=0 && y1%4==0) || y1%400==0)

                                 d=29;

  else

                                 d=28;

  return d;

}

 

void main()

{

  long unsigned int t;

  signed int y,y1,m,m1,d,da,i,j,k;

  char

a[12][20]={"January","February","March","April","May","June","July","August","September","October","November","December"};

  clrscr();

  textcolor(CYAN);

  cprintf("Enter the year: ");

  scanf("%d",&y);

  if(y<0)

  {

  printf("Wrong entry\n");

  exit();

  }

  printf("Enter the month: ");

  scanf("%2u",&m);

  if(m<=0 || m>=13)

                                 m=1;

  clrscr();

  gotoxy(32,2);

  cprintf("Calendar");

  y1=0;

  t=0;

  while(y1<y)

  {

                                 if((y1%100!=0 && y1%4==0) || y1%400==0)

                                   t=t+366;

                                 else

                                   t=t+365;

                                 y1++;

  }

  m1=1;

  while(m1<m)

  {

                                 d=day(m1,y);

                                 t=t+d;

                                 m1++;

  }

  d=t%7;

 

  printf("\n                           Month: '%s'",a[m-1]);

  printf("Year: '%u'",y);

 

printf("\n\n\n\n    %3s%3s%3s%3s%3s%3s%3s\n","Sun   ","Mon   ","Tue   ","Wed   "

,"Thu   ","Fri   ","Sat   ");

  textcolor(GREEN+BLINK);

  k=1;

  for(i=1;i<=day(m,y);i++,k++)

  {

                                 if(i==1)

                                 {

                                   if(d==0)

                                   {

                                     for(j=1;j<7;j++,k++)

                                       printf("%6s","");

                                   }

                                   else

                                   {

                                      for(j=1;j<d;j++,k++)

                                                     printf("%6s","");

                                   }

                                 }

                                 cprintf("%6d",i);

                                 if(k%7==0)

                                   printf("\n");

  }

  gotoxy(27,22);

  getch();

}

                                   APPLICATIONS 

Because digital calendar is very small and inexpensive devices that enhance the popularity of product designs, they are often incorporated into all kinds of devices such as
• Cars
• Radios
• Televisions 

Views: 86 | Added by: vijoriya | Tags: embedded project, programming code, c++, Digital Calendar | Rating: 0.0/0
Total comments: 0
avatar