HI All
I trying to build a digital time and date clock using 89S52 micro-controller and DS1307 with 7 segments and LED's, I use 74595 to multiplexing the 7 segments and LED the problem is i have a blink on display as i use Proteus simulation and the LED that indicate the PM blinking all the time, my code is take 3.6ms to read the information from the DS1307 and goto loop to display the info i use 14 (7 segments) to show the time and date LED to indicate the PM the loop repeat 183 times to complete 1 seconds then read the info again and display
in loop every 7 segment take 0.42ms to display digit and go of for 5.88ms and repeat display every 6.3ms and the LED take a 0.42ms i use 74595 daisy-chain to multiplexing,
i need to know how i calculate the POV correctly and how to display LED with 7 segment (the time) for each
what is wrong with my code
Kindly need help
I trying to build a digital time and date clock using 89S52 micro-controller and DS1307 with 7 segments and LED's, I use 74595 to multiplexing the 7 segments and LED the problem is i have a blink on display as i use Proteus simulation and the LED that indicate the PM blinking all the time, my code is take 3.6ms to read the information from the DS1307 and goto loop to display the info i use 14 (7 segments) to show the time and date LED to indicate the PM the loop repeat 183 times to complete 1 seconds then read the info again and display
in loop every 7 segment take 0.42ms to display digit and go of for 5.88ms and repeat display every 6.3ms and the LED take a 0.42ms i use 74595 daisy-chain to multiplexing,
i need to know how i calculate the POV correctly and how to display LED with 7 segment (the time) for each
what is wrong with my code
Code:
sbit test=P1^6;
sbit Latch = P3^5;
sbit Data = P3^6;
sbit Clock = P3^7;
sbit seconds = P2^2;
sbit SetKey = P3^2;
sbit UpKey = P3^3;
sbit DownKey = P3^4;
sbit OE =P2^0;
unsigned char i;
unsigned char pSetArray[]={0,13,4,Tuesday,4,10,14,1}; //sec,min,hour,day,date,month,year,PMorAM
unsigned char *pInfoArray=&pSetArray;
void select_display(int digit,select1,select2)
{unsigned char i,value;
Latch=0;
value=Seven_Segment_Selector[select2];
for(i=0;i<8;++i)
{Data=value&0x01;
Clock=0;
Clock=1;
value>>=1;}
value=Seven_Segment_Selector[select1];
for(i=0;i<8;++i)
{Data=value&0x01;
Clock=0;
Clock=1;
value>>=1;}
value=Seven_Segment_Digit[digit];
for(i=0;i<8;++i)
{Data=value&0x01;
Clock=0;
Clock=1;
value>>=1;}
Latch=1;
delay(1);
}
void main()
{ IT0 = 1;
EX0 = 1;
InitI2C(); // Initialize i2c pins
// Set initial time
Set_DS1307_RTC_Info(pInfoArray);
seconds=1;
while(1)
{OE=1;test=1;seconds=~seconds;
EA = 1;
pInfoArray=Get_DS1307_RTC_Info();
test=0;OE=0;
for(i=0;i<183;++i){
select_display( pInfoArray[0]/10,0,8 );//Seconds higher nibble
select_display( pInfoArray[0]%10,1,8 );//Seconds lower nibble
select_display( pInfoArray[1]/10,2,8 );//min MSB
select_display( pInfoArray[1]%10,3,8 );//min LSB
if(pInfoArray[2]/10==0);else select_display( pInfoArray[2]/10,4,8 );
select_display( pInfoArray[2]%10,5,8 );
if(pInfoArray[4]/10==0);else select_display( pInfoArray[4]/10,6,8 );
select_display( pInfoArray[4]%10,7,8 );
if(pInfoArray[5]/10==0);else select_display( pInfoArray[5]/10,8,0 );
select_display( pInfoArray[5]%10,8,1);
select_display( pInfoArray[6]/10,8,2 );
select_display( pInfoArray[6]%10,8,3 );
select_display( 2,8,4 );
select_display( 0,8,5 );
if(pInfoArray[7]==1)select_display(0,8,6 );
}
}