SAMO6
Newbie level 5
I am trying to generate delay of variable length using delay function in MPLAB X IDE for PIC18F4550.
Crystal Frequency=20MHz.
Basically, I am trying to generate delay of value which will be given as a parameter to delay_us function as shown below:
Such as, delay_us(10) function will generate 10 microsecond delay.
Generally, I use 'for loop' for delay as shown below.
I never understood actual meaning of those values written there in above code, I always used to write any value there, but now I am requiring 10 microsecond delay in my application.
So, Can anyone tell me how can I implement a program for 10 microsecond delay for PIC18f4550, Xtal frequency=20Mhz.
Plz, help.
Crystal Frequency=20MHz.
Basically, I am trying to generate delay of value which will be given as a parameter to delay_us function as shown below:
Such as, delay_us(10) function will generate 10 microsecond delay.
Generally, I use 'for loop' for delay as shown below.
Code:
void delay()
{
for(i=0;i<10;i++)
{
for(j=0;j<1000;j++);
}
}
So, Can anyone tell me how can I implement a program for 10 microsecond delay for PIC18f4550, Xtal frequency=20Mhz.
Plz, help.
Last edited by a moderator: