Blinking LED with PIC16F684

This very simple design shows how to make a blinking LED using PIC16F684 MCU. In my previous post I’ve used PIC16F877/86 however most of basic circuits do not require a lot of I/O pins and PIC16F684 small 14 pin package is more than enough in this case. PIC16F684 microcontroller was chosen as a target device due to its wide operating voltage range 2.0 to 5.5v and high current source capability to drive LED directly. Also it has an internal 8Mhz oscillator thus reducing the number of external components. Only LED and current limiting resistor are required. Despite its low-pin count this microcontroller incorporates a lot of peripheral blocks like 10 bit A/C converter and enhanced PWM module making it a perfect candidate for prototype design. I’m planning to use it in my future projects and perhaps adapt some of my code to run on this device. Here is the schematic of this design. This time I’ve also shown how to connect PICkit 3 programmer to PIC16F684.

Blinking LED PIC16F684 Schematic

Assembly code is shown next .You can also dowload a HEX file here. ON/OFF LED frequency can be changed by modifying a delay function.

LIST P=PIC16F684
include P16f684.inc

__CONFIG _CP_OFF & _WDT_OFF & _BOD_OFF & _PWRTE_OFF & _INTRC_OSC_NOCLKOUT & _CPD_OFF

org 0x00
reset:
goto start
org 0x04
start: bcf STATUS, RP0             ;Bank 0
bcf STATUS, RP1
clrf PORTC                                ;Clear PORTC
bsf STATUS, RP0
clrf TRISC                                  ;PORTC is OUTPUT
bcf STATUS, RP0
loop:
bsf PORTC,0X05                      ;Set RC5 HIGH
call delay
bcf PORTC,0X05                      ;Set RC5 LOW
call delay
goto loop
;————————————
delay:
movlw 0xFF
movwf 0x51
CONT1: movlw 0xFF
movwf 0x52
CONT2: decfsz 0x52,f
goto CONT2
decfsz 0x51,f
goto CONT1
return
;————————————
end