Microchip Technology

user Occupation hasn't been added


  • Simple Single-Digit Calculator

  • Created: May 24, 2016

    • view587
    • comment0
    • bookmark0
    • fork1


No description available.


This reference design is a simple single-digit calculator using PIC12F675 microcontroller. This design implements 4 basic operations: addition (+), subtraction (-), multiplication (x) and division (/). In this design, the PIC12F675 is running on its internal 4MHz oscillator. The GP0, GP1 and GP2 pins are used to interface LCD through 4094 IC. The LCD is used here just to show the pressed key value and also used to display the results. Usually 8 pins are used to interface 4x4 keypad with any microcontroller. The 4 pins are used to attach columns and 4 pins are used to attach rows.

In this design, the pin GP4 (AN3) of the PIC12F675 is used to interface the keypad. The ADC of PIC12F675 will then read the values that correspond to each voltage to determine the pressed key. By using some 1N4007 diodes, different voltages will be generated on each pressed key. As shown in this circuit, row A has 3 diodes, row B has 2 diodes, row C has one diode and row D has no diode attached to it. These diodes are pulled-up from one side by a 470Ω resistor. The column 1 wire of keypad is attached with the ground. The column 2 is attached with Schottky diode. The column 3 is attached with a 2.7V Zener diode. The column 4 is attached with a 3.0V Zener diode. The ADC of PIC12F675 will then read the values that correspond to each voltage to determine the pressed key. In this way, connecting only one pin of PIC12F675 will successfully achieve the desired functionality. On the other hand, the PIC12F675 microcontroller has only 6 IO pins (5 of them can be made input or output, but pin4 (GP3) can only be made an input). So it is not possible to directly attach LCD with PIC12F675 even in 4-bit mode. To make this possible, a serial to parallel shift register IC (HEF4094BP) is used in this circuit. In this way, by only using 3 pins of PIC12F675 microcontroller, the LCD can be interfaced with it in 4-bit mode.

One of the features of this design is that it allows the user to input a single digit from 0-9. The ‘ON/C’ button can be pressed anytime to reset the calculator. This project is also designed to display an error message if wrong input is detected. The main purpose of this design is to explore the capability of the PIC12F675 microcontroller to perform simple processes such as single-digit calculation.