PIC18F452 based Calculator with Keypad and LCD
by Ivan
Development of a Calculator using PIC18f452 Microcontrollers:
The main components of the Project are:
1.The heart of the project is Microcontroller PIC 18f452
2. 2 line alpha numaric LCD
3. keypad for input
Keypads are small keyboards used to enter numeric or alphanumeric data into microcontroller systems. Keypads are available in a variety of sizes and styles, from 2 x 2 to 4 x 4 or even bigger. This project uses a 4 x 4 keypad and an LCD to design a simple calculator.
shows the structure of the keypad used in this project which consists of sixteen switches formed in a 4 x 4 array and named numerals 0–9, Enter, “+”, “.”, “-”,“*”, and “/”. Rows and columns of the keypad are connected to PORTB of a microcontroller which scans the keypad to detect when a switch is pressed. The
operation of the keypad is as follows:
1 A logic 1 is applied to the first column via RB0.
2 Port pins RB4 to RB7 are read. If the data is nonzero, a switch is pressed. If RB4 is 1, key 1 is pressed, if RB5 is 1, key 4 is pressed, if RB6 is 1, key 9 is pressed, and so on.
3 A logic 1 is applied to the second column via RB1.
4 Again, port pins RB4 to RB7 are read. If the data is nonzero, a switch is pressed. If RB4 is 1, key 2 is pressed, if RB5 is 1, key 6 is pressed, if RB6 is 1, key 0 is pressed, and so on.
5 This process is repeated for all four columns continuously.
In this project a simple integer calculator is designed. The calculator can add, subtract,multiply, and divide integer numbers and show the result on the LCD. The operation of the calculator is as follows: When power is applied to the system, the LCD displays text “CALCULATOR” for 2 seconds. Then text “No1:” is displayed in the first row of the LCD and the user is expected to type the first number and then press the ENTER key.Then text “No2:” is displayed in the second row of the LCD, where the user enters thesecond number and presses the ENTER key. After this, the appropriate operation key should be pressed. The result is displayed on the LCD for five seconds and then the LCD is cleared, ready for the next calculation. It is important to realize that when a key is pressed or released, we get what is known as
contact noise, where the key output pulses up and down momentarily, producing a number of logic 0 and 1 pulses at the output. Switch contact noise is usually removed either in hardware or by programming in a process called contact debouncing. In software the simplest way to remove the contact noise is to wait for about 20ms after a switch key is pressed or switch key is released.
a function called getkeypad has been developed to
read a key from the keyboard. The mikroC language has built-in functions called Keypad_Read and Keypad_Released to read a key from a keypad when a key is pressed and when a key is released respectively.connect PIc 16f877 to burglar system
PIC 16F877, 18F452 and 18F4550,PIC16F877, PIC18F452,PIC18F4550,16f876,16f84,microcontroller projects,lm35,lm34,lm335,temperature sensor,MikroC Projects connect PIc 16f877 to burglar system
Hi , all !
Am sorry bald english ! Im the pensioner and now is the time to microcontroler to
programed . Now this project for calculator me to turture . With the simulator
out from main loop not to go after the key ? Very much I to have this problem
to save . I am 70 jears ago and I not to use this for the earning an income .
Please , if is perhaps to help !
Kind regards , Daniel !