This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DELAY NOT WORKING ACCORDINGLY


#include<reg51.h>

void delay()        //Function to provide a time delay of approx. 1 second. Timer 1.
{
    int i;
    for(i=0;i<20;i++)
    {
        TL1=0xFD;
         TH1=0x4B;
         TR1=1;
         while(TF1==0);
         TR1=0;
         TF1=0;
    }
}


void main()
{
char num[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67};// Hex values corresponding to digits 0 to 9
        int c;
        while(1)
        {
                for(c=0;c<10;c++)
                {
                P1=num[c];
                delay();

                }
        }
}

Hi guys,
I am not getting delay of 1 sec.blinking rate of 7 segment is too fast in comparison of delay calculated(=1sec). Any help will be appreciated..
thanks

Parents
  • Using 11.0812MHz Crystal and P89V51RDFN2 uC unit.
    Using it in 1/12 clock cycle mode so that 1/12 of 11.0592 is one T state.
    For it 1/12 * 11.0592 is effective clock.
    Which is 12/11.0592= 1.085us in time domain.

    So is it 11.0592 MHz, 11.0812 MHz or 11.95 MHz? Pick what the board is actually using for consistencies sake.

    How are you related to the OP?

    The 1.085us math only works for the 11.0592 MHz, not for the 11.95 MHz

Reply
  • Using 11.0812MHz Crystal and P89V51RDFN2 uC unit.
    Using it in 1/12 clock cycle mode so that 1/12 of 11.0592 is one T state.
    For it 1/12 * 11.0592 is effective clock.
    Which is 12/11.0592= 1.085us in time domain.

    So is it 11.0592 MHz, 11.0812 MHz or 11.95 MHz? Pick what the board is actually using for consistencies sake.

    How are you related to the OP?

    The 1.085us math only works for the 11.0592 MHz, not for the 11.95 MHz

Children