Blinking LED
- First, use the MPLAB X to generate hex;
- Then, use protelus to draw “Schematic Capture”;

- Finally, import the hex file into the MCU component.
Right-click the "mcu" icon and select "Edit Properties".

PIC16F887
- LED
- 470R Resistor
- 8Mhz Crystal
- Two 22pF capacitors in parallel
PROCESSOR 16F887
#include <xc.inc>
config FOSC=INTRC_NOCLKOUT
config WDTE=OFF, PWRTE=ON, MCLRE=ON, CP=OFF, CPD=OFF, BOREN=OFF, IESO=OFF, FCMEN=OFF, LVP=OFF
#define Count1 0x20
#define Count2 0x21
PSECT MainCode,global,class=CODE,delta=2
MAIN:
BANKSEL TRISB
BCF TRISB,0
BANKSEL PORTB
MainLoop:
BCF PORTB,0
CALL DELAY3
BSF PORTB,0
CALL DELAY3
GOTO MainLoop
DELAY3:
DECFSZ Count1,1
GOTO DELAY3
DECFSZ Count2,1
GOTO DELAY3
RETURN
END
Ref