[51] 8051 based rtc circuit

Status
Not open for further replies.

tapu

Full Member level 5
Joined
Sep 15, 2014
Messages
246
Helped
1
Reputation
2
Reaction score
2
Trophy points
1,298
Location
india
Visit site
Activity points
3,164
Dear all
I want to design an alarm clock.with 8051 & 4 digit led display.I have RTC code but I want to know how to multiplex rtc data to 4 digit led display.& what are essential components to run circuit efficiently. Please give reply.
 
Last edited:

Dear all,
I replied too late becouse i was using buffers & decoders for each display.but which is very costly method.now i want to multiplex.I have tried above circuit but it does not run properly on proteus.& shows error ''simulation does not run in real time due to excessive load of cpu''.please reply.
 

dont use buffers and decoders, the circuit given above is simple try it. or else give your code here
 

Here is a code for multiplexing 7 segment displays. In proteus I make circuit as given above but shows error in simulation.I did not make actual hardware yet.
Code:
#include<reg51.h>

sbit e1=P2^0;   //for display1
sbit e2=P2^1;   //for display2
sbit e3=P2^2;    //for display3
sbit e4=P2^3;   //for display4
                      // P3 is a data port.
void delay_ms(unsigned int ms_count);
void delay_us(unsigned int us_count);


void main()
	
{
P2=0x00;       //turning off all displays(common cathod)

 while(1)
 {
 
 P3=0x40;   
	e1=1; //enable display1
	 delay_ms(2);
e1=0;
	P3=0xf9;
	 e2=1;
	 delay_ms(2);
   e2=0;
	 
	P3=0x24;
	 e3=1;
	 delay_ms(2);
	 e3=0;

	P3=0x30;
	 e4=1;
	 delay_ms(2);
	 e4=0;
  }
  }


 void delay_ms(unsigned int ms_count)
 {
        while(ms_count!=0)
         {
            delay_us(112);   //delay_us is called to generate 1ms delay
             ms_count--;
            }
   }
 

  void delay_us(unsigned int us_count)
 {  
    while(us_count!=0)
      {
         us_count--;
       }												   
   }
 

common cathode display with out driver for 8051 is not ideal. use common anode.

the code seems to be okay. increase delay to 8ms.
sorry, i dont have proteus to check this code
 

Dear All.
I have added delay by 8ms and more but problom remains same.here is a circuit
 

Can you use mikroC PRO 8051 Compiler ? Is it ok if I provide RTC DS1307 mikroC PRO 8061 code. mikroC PRO 8051 has software I2C library. I will write RTC code using it.

Have you checked the I2C and DS1307 projects based on 8051 at saeedsolutions.blogspot.com

They work fine.
 

Dear all,
saeeds blog has lcd interfacing.here i want to multiplex 4 seven segment led's for clock project(i shown only multiplex code).
Is Microc compiler easy for keil user?becouse i use keil.
 

Code:
[ATTACH=CONFIG]114651._xfImport[/ATTACH]#include<reg51.h>
unsigned char  DSPL_RAM[4]={1,2,3,4};//this is for rtc data like HH MM 
unsigned char code image[10]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};
void main()
{
	TMOD=0x01; //timer 0 in 16bit timer
	TH0=0xEF;//for 4ms so refresh rate 4x4=16ms==60Hz
	TL0=0xBA;
	ET0=1;//enable timer 0
	EA=1;//globle enable
	TR0=1;//timer run
	while(1)
	{
		//do your task for read rtc and update DSPL_RAM
	}
}
void ISR() interrupt 1
{
	static unsigned char i;//for digit counter
	TH0=0xEF; //reload timer for next segment
	TL0=0xBA;
	P2|=0x0F;//OFF ALL SEGMENT
	P0=image[DSPL_RAM[i]];
	P2&=~(1<<i); //ON CROSPOND SEMENT
	if(i++>=3)
		i=0;
}
=31
i think this help you if you use 8ms delay so total time 8x4=32ms that refresh rate is 1/32~31Hz this is not good for view
 
Reactions: tapu

    tapu

    Points: 2
    Helpful Answer Positive Rating
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…