How to create Exact 1 millisecond delay in PIC16F877A and Blink led

TO CREATE EXACT 1 MILLISECOND DELAY IN PIC16F877A USING INBUILT DELAY FUNCTION 


#define _XTAL_FREQ 20000000 is to initialize the operating frequency of the micro controller. 

DELAY IN MILLISECOND :

__delay_ms(500); is the function to create 500 millisecond, 500 is the number of millisecond and ms is to indicate millisecond 

DELAY IN MICROSECOND:

then u want to create delay in microsecond, u just replace__delay_ ms( ) and use __delay_us( ); ie __delay_us(500)

__delay_us(500); is to create 500 microsecond delay.

u need exact 1 second means __delay_ms(1000);

U CAN DOWNLOAD THE COMPLETE MPLAB IDE PROJECT FILE WITH PROGRAM + PROTEUS SIMULATION HERE

download here






Comments