How to call a function after a specific clock period

hi
I am using 89c51. for using serial port I am using these commands

SCON  = 0x50;                  /* SCON: mode 1, 8-bit UART, enable rcvr    */
TMOD  = 0x20;                  /* TMOD: timer 1, mode 2, 8-bit reload      */
TH1   = 0xfd;                  /* TH1:  reload value for 9600 baud         */
TR1   = 1;                     /* TR1:  timer 1 run                        */

these are working correctly
------------
but in main function i am calling 2 functions

for example
---------------------

void main()
{
    while(1)
    {
        if(RI)
        {
            GetData();
        }
        if(??????????)
        {
            DisplayData();
        }
    }
}


At the location "??????????" I want to call the DisplayData() after a specific clock period, for example after every 1000 clocks. is it possible to set the timer0 of 89c51 for this purpose.

Parents Reply Children
No data
More questions in this forum