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 at sdcc cross compiler

hi members...

i have a question today. i'm working with the sdcc cross compiler and metabolize c in assembler.
i want to delay some programms but i can't use the function sleep or wait in sdcc.
i have realized the delay with grinds at the moment but its very inexactly.

sorry for the bad spelling i'm a german schoolboy i can't it superiorly.

yours sincerely

nick

Parents Reply Children
  • i have solved the problem alone...

    i have write the folowing timer function (delay of one second):

    void timer(void)
    {
    #define TF0_VECTOR 1

    int R7=20;
    TR0=0;
    TF0=0;

    TMOD=TMOD | 0xF0; //Timer 0,16 bit Timer
    TMOD=TMOD & 0x01;

    TL0=0xAF; //Timer 0, set 1 second
    TH0=0x3C;
    TR0=1; //start timer

    while(R7!=0)
    {
    if(TF0!=0) //test if the timer overflow
    {
    TR0=0; //stop timer
    TF0=0; //clear the overflow flag
    R7--;
    TR0=1;
    }
    }


    }


    Thank's for you help

    yours sincerely

    nick