How to use PIC12F675 GPIO pin as input (Code + Proteus simulation)
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. 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.
The code for reading the status of GP0 pin is shown below.
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)
For All Your PCB Need, One-stop PCB Solution Services Appear:
EasyEDA: free PCB design tool, 200,000+ engineers are using
PCBs: 10pcs 2-layer 10x10cm only $8.21, on-time global shipping
Components: save 50% on cost, save on freight if shipped with ordered PCBs
Current Project / Post can also be found using:
- GPIO pic16f84
- pic12f675 code examples
- pic12f675 use gpio2 as an input