Summary of How to use PIC12F675 GPIO pin as input (Code + Proteus simulation)
This article explains how to configure PIC12F675 GPIO pins as inputs using C language in MPLAB with the HI-TECH C compiler. It details a circuit where GP0 acts as an input connected to a push button, while GP5 controls an LED to indicate the pin's status. The system uses an internal 4MHz clock, setting GP5 high when the button is pressed and GP0 reads high.Parts used in the PIC12F675 Input Example:
- PIC12F675 microcontroller
- Push button
- LED
- MPLAB IDE
- HI-TECH C compiler
- Proteus simulation software
This post provides an example code to use PIC12F675 GPIO pins as inputs. After going through this example, you will understand how to make PIC12F675 pins as inputs and how to read their value in the code. This code is written in C language using MPLAB with HI-TECH C compiler.You can download this code from the 'Downloads' section at the bottom of this page.
It is assumed that you know how to blink an LED with PIC12F675 microcontroller. If you don't then please read this page first, before proceeding with this article.
Following figure shows the circuit used to demonstrate how to get input in PIC12F675 micro-controller.
In this figure, PIC12F675 is running using internal clock of 4MHz[1]. GP0 pin is being used as the input pin. When the push button is in the pushed state then, GP0 pin is high, otherwise GP0 pin is low. Whenever GP0 pin is high, then GP5 pin (Attached with the LED) is also made high just to indicate correct reading of GP0 pin status in the micro-controller.
Code
The code for reading the status of GP0 pin is shown below.
Downloads
Input pin code using PIC12F675 was compiled in MPLAB v8.85 with HI-TECH C v9.83 compiler and simulation was made in Proteus v7.10. To download code and Proteus simulation click here.
For more detail: How to use PIC12F675 GPIO pin as input (Code + Proteus simulation)
Quick Solutions to Questions related to PIC12F675 Input Example:
- What language is the code written in?
The code is written in C language. - Which compiler is used for this project?
The HI-TECH C compiler is used within MPLAB. - How does the circuit determine if the button is pushed?
When the push button is in the pushed state, GP0 pin becomes high. - What clock speed is assumed for the PIC12F675?
The PIC12F675 runs using an internal clock of 4MHz. - Can I download the code from this page?
Yes, you can download the code from the Downloads section at the bottom of the page. - Is Proteus simulation available for this project?
Yes, simulation was made in Proteus v7.10 and can be downloaded. - What happens to GP5 when GP0 reads high?
GP5 is made high to indicate correct reading of the GP0 pin status.
Related projects
PIC 12F675 Programmable 12V Battery Monitor
Being an active outdoor guy, I have a few different types of 12V lights and a variety of battery types. - For...
Audio, Sound & Radio · PIC12F675Audio CRO using PIC12F675 Microcontroller
This project is a miniature Audio CRO. For those not familiar with the abbreviation "CRO," it means "Cathode Ray Oscilloscope" and this...
Development Boards & Kits · PIC12F675DIY $1 PIC 12f675 JDM Programmer (Cheap and Easy)
Hi EveryBody i am Again Doing something. and it is with PIC's! Almost Everybody do not want a Big Arduino in their...
Communication & Interfacing · PIC18F4520CAN FD Node based on a PIC18 Microcontroller
The introduction sets the stage for an embedded systems project that involves developing a Embedded C CAN FD project using the MCP2517FD...
Communication & InterfacingLAN9662 Gigabit Switch: Optimized for Industrial Ethernet
Introduction It should come as little surprise therefore that one element of what is now more commonly referred to in some circles...
Communication & InterfacingPIC Microcontroller: Fundamentals & Applications for Students
Introduction Microcontrollers are the key components in the embedded systems market. A variety of embedded systems was formed and developed after the...

