1 millisecond delay in 8051 C Program

1 millisecond delay in 8051 C Program
>> Most of microcontroller beginners begins with 8051 microcontroller. And also starts with LED blinking. LED blinking is a simplest program for beginners. So they can test their development board with it.
>> But it is somewhat difficult to make precise delay in LED blinking. You can calculate precise delay in assembly language. In c language you can’t calculate delay. 
>> So here I am giving one function in C for 1 millisecond delay in 8051. You can simply copy past it in your program. But remember this function only works for 11.0592 MHz crystal frequency.

>> This delay function is originally made by my genius friend Bhavin Patel using oscilloscope in proteus simulator.

>>1 millisecond delay function:

void delay_ms(unsigned int k) //delay in milliseconds for 11.0592MHz crystal

{                                            //E.g. delay_ms(100)

unsigned int i,j;

for(i=0;i

{

for(j=0;j<110;j++); }

}


>> Get proteus simulation files from here.

Incoming search terms:

Amazon Auto Links: the template could not be found. Try reselecting the template in the unit option page.

by

Comments

  1. Hi, I think your blog might be having browser compatibility issues.

    When I look at your blog in Opera, it looks fine
    but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, awesome blog!

Speak Your Mind

*