Display Current time & date in LCD 16x2 using pic16f877a ( Hi Tech C )

Status
Not open for further replies.

WhyWhy

Member level 4
Joined
Mar 18, 2013
Messages
68
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,779
Hi guys,

i know how to display word in LCD,but how i display the current time and date.
Thanks for help.



Code:
#include<htc.h>
#include<pic.h>

#define RS RB2
#define EN RB3
#define D4 RB4
#define D5 RB5
#define D6 RB6
#define D7 RB7
#define _XTAL_FREQ 8000000
#include "lcd.h"

void main()
{
  int i;
  TRISB = 0x00;
  Lcd4_Init();
  while(1)
  {
    Lcd4_Set_Cursor(1,1);
    Lcd4_Write_String("LCD Hello World");
    for(i=0;i<15;i++)
    {
      __delay_ms(1000);
      Lcd4_Shift_Left();
    }
    for(i=0;i<15;i++)
    {
      __delay_ms(1000);
      Lcd4_Shift_Right();
    }
    Lcd4_Clear();
    Lcd4_Set_Cursor(2,1);
    Lcd4_Write_Char('e');
    Lcd4_Write_Char('S');
    __delay_ms(2000);
  }
}

Regards,
YY
 

Hi Jayanth,

Why the minutes need to divide 10 and then + 38 ( minutes /10 +48) and minutes (510 + 48) ?

Regards,
YY
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…