SAMO6
Newbie level 5
Hello Everyone,
Can anyone tell me, How to implement the delay function for PIC18F4550? I tried the simple for loop for LED blinking, But, LED is not blinking it is simply in ON state.
I used below mentioned simple for loop for delay generation.
I want to know how can I generate delay of 100 milliseconds,10 microseconds using 20Mhz crystal frequency.
I also tried macros like __delay_us()__delay_ms(),etc. But, they are not working.
I also know I can use timer for delay generation, But it is complicated and I don't know how to do that, Can anyone please explain me about best method for delay generation for PIC18F4550?
Can anyone tell me, How to implement the delay function for PIC18F4550? I tried the simple for loop for LED blinking, But, LED is not blinking it is simply in ON state.
I used below mentioned simple for loop for delay generation.
Code:
void delay1()
{
unsigned int q;
for(q=0;q<10000;q++);
}
I also tried macros like __delay_us()__delay_ms(),etc. But, they are not working.
I also know I can use timer for delay generation, But it is complicated and I don't know how to do that, Can anyone please explain me about best method for delay generation for PIC18F4550?