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 generation

Hello, I would like to know how can i use delays in my program as there is no inbuilt delay for 89c2051. i want to know how can i decide delay timing when I am using 12 MHZ external crystal

Parents
  • You selected the wrong process as this is a derivative of the C51 the C251 is a different processor with a different ISA (although it can be made to run C51 code).

    Timing can be implemented in many ways. It is best to know how precise your delay needs to be. You can use the timers built in for fairly precise timing delays. So you need to know your delay time and how precise it needs to be first. If you need to delay a few micro seconds.
    Use useless instructions.
    Ex

    char temp;
    
    // 2-3 instruction cycles
    temp = 0;
    // 2-3 instruction cycles
    temp = 1;
    

    Perhaps some definition of how much and how precise?

    I've known many a project fail due to BAD timing delay design.

    Stephen

Reply
  • You selected the wrong process as this is a derivative of the C51 the C251 is a different processor with a different ISA (although it can be made to run C51 code).

    Timing can be implemented in many ways. It is best to know how precise your delay needs to be. You can use the timers built in for fairly precise timing delays. So you need to know your delay time and how precise it needs to be first. If you need to delay a few micro seconds.
    Use useless instructions.
    Ex

    char temp;
    
    // 2-3 instruction cycles
    temp = 0;
    // 2-3 instruction cycles
    temp = 1;
    

    Perhaps some definition of how much and how precise?

    I've known many a project fail due to BAD timing delay design.

    Stephen

Children
  • HI.

    whot delay du u need?

    how acurate du u need?

    u can use 8051 timer for good acurate timing for reletivly long delays or if u want short dlays u can use code.

    but if u use code i advice u do not use it in c. u do not know whot machine code they're is so u dont know how acurate. four this u need asembler.

    Always yo're freind.

    Zeusti.