Tuesday, 14 February 2012

How to generate Milli second digital delay using C programming


/* Milli  second digital delay (Input value assign by the user)*/

void DelayMS(int delayInMs)   //value of delayInMs=1,2,3,.......
   {
  usigned long i,j;
for(i=0;i<delayInMs;i++)

for(j=0;j<6024;j++);

    }  //End of function

void main()
{
  DelayMs(500);//generate delay of 500 ms
}

Common Programming Errors:-
Sometime programmer started with main and give the definition of function after that. its shows error to avoid that you can write only function name before main and define after main.

Good Programming Practice:-
Use uppercase letter for function name and you can use underscore( _ ) sign also.

No comments:

Post a Comment

Compiler for C,C++ and Python {paste your programme to see the output}