PIC16F84A LED blink using push button – CCS C compiler

Interfacing PIC16F84A with push button

This topic shows how to turn on and off 2 LEDs connected to PIC16F84A microcontroller using 2 push buttons. The goal of this example is to see how to read the PIC16F84A inputs with CCS C compiler.
LED blink using push button circuit:
Example circuit schematic diagram is shown below.

PIC16F84A read inputs example circuit

The circuit is simple there 2 LEDs and 2 buttons each button controls one LED, for example if the first push button which is connected to RB0 is pressed then the first LED which is connected to RA0 will be turned ON, and if the same button pressed again the same LED will be turned OFF, and the same thing for the second button and the second LED.
LED blink using push button CCS PIC C code:
Example C code is the one below. It was tested with CCS C compiler version 5.051.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.