Tools & Downloads   /   Programmers & ICSP

Calculator Test using PIC24FJ64GA006 with Proteus Simulation

PIC24 Calculator Project using LCD keypad with Proteus simulation. This PIC24 Calculator Project includes circuit and source code.

Published

At a glance

CategoryProgrammers & ICSP
IncludesCode · Circuit diagram · Proteus · Download files
Reading time~4 min
Jump to a section
  1. Introduction
  2. How the Project Works (Overview)
  3. Workflow Explanation
  4. Key Features
  5. Components Used
  6. Applications
  7. Explanation of Code (High-Level)
  8. Core Modules:
  9. Source Code
  10. Proteus Simulation
  11. Conclusion
  12. Complete File
  13. Quick Solutions to Questions related to Calculator Test using PIC24FJ64GA006 with Proteus
  14. Related projects

Summary of Calculator Test using PIC24FJ64GA006 with Proteus Simulation

This article details a practical embedded systems project: a calculator built using the PIC24FJ64GA006 microcontroller and simulated in Proteus. It utilizes a 4x4 matrix keypad for input and an LCD for output, processing real-time arithmetic operations like addition, subtraction, multiplication, and division. The firmware includes error handling for scenarios such as division by zero and supports floating-point numbers. Ideal for educational purposes, this project demonstrates effective human-machine interfacing and modular firmware design within an embedded environment.

Parts used in the Calculator Test using PIC24FJ64GA006 with Proteus Simulation:

  • PIC24FJ64GA006 Microcontroller
  • 16x2 LCD (LM020L compatible)
  • 4x4 Matrix Keypad
  • Pull-up resistors
  • Diodes
  • Power supply

Introduction

The Calculator Test using EASYHDL is a practical microcontroller project built on the PIC24FJ64GA006 and simulated in Proteus. This project demonstrates how a keypad-based calculator can be implemented using embedded systems concepts.

It uses a 4×4 matrix keypad for input and a 16×2 LCD display for output, making it a great example of DIY electronics and human-machine interfacing. The system processes arithmetic operations in real-time and displays results instantly. This project is ideal for understanding Proteus simulation, firmware logic, and practical electronics design.

PIC24 Calculator Project is a practical microcontroller project built using the PIC24FJ64GA006, featuring an LCD display and keypad input with Proteus simulation.

PIC24 breadboard calculator with LCD and keypad
Illustrative View of the Concept.

How the Project Works (Overview)

The calculator works by continuously scanning the keypad for user input. Each pressed key is interpreted either as a number or an operator.

  • Numeric inputs are stored in a buffer
  • Operators trigger arithmetic calculations
  • The result is formatted and displayed on the LCD

The firmware maintains:

  • Left operand (lvalue)
  • Right operand (rvalue)
  • Last operator (lastop)

When = is pressed, the system computes and shows the result. Error handling is included for cases like division by zer

Workflow Explanation

Based on the schematic and code logic:

  1. Keypad Input (4×4 Matrix)
    • Rows driven by MCU
    • Columns read with pull-up resistors
  2. Microcontroller Processing
    • Key scanning
    • Input buffering
    • Arithmetic computation
  3. LCD Output
    • Commands and data sent via PORTD
    • Displays numbers and results
  4. Control Flow
    • Infinite loop polling keypad
    • Decision: digit or operator
    • Execute operation → update display

Key Features

  • Real-time calculator using keypad input
  • Supports + , − , × , ÷ operations
  • Floating-point number handling
  • Error detection (division by zero)
  • LCD-based user interface
  • Efficient keypad scanning algorithm
  • Clean firmware structure using modular functions

Components Used

From schematic and source code:

  • PIC24FJ64GA006 Microcontroller
  • 16×2 LCD (LM020L compatible)
  • 4×4 Matrix Keypad
  • Pull-up resistors (for keypad columns)
  • Diodes (row isolation in keypad)
  • Power supply

Applications

This type of embedded systems project can be used in:

  • Educational calculator systems
  • Industrial control panels
  • Embedded UI systems
  • Digital instrumentation
  • Learning microcontroller project design
  • Custom input-output interfaces

Explanation of Code (High-Level)

Core Modules:

  • Keypad Interface
    • Scans rows/columns to detect key press
    • Returns ASCII value of pressed key
  • LCD Driver
    • Sends commands/data using PORTD
    • Handles busy flag and display control
  • Calculator Engine
    • Stores operands and operators
    • Performs arithmetic operations
    • Formats output for display
  • Main Control Loop
    • Continuously reads input
    • Updates display dynamically
PIC24 calculator circuit with LCD and keypad

Source Code

C source
/******************************************************************************            
************                 LABCENTER ELECTRONICS                  ************            
************           Proteus VSM Sample Design Code               ************            
************                   MPLAB C30 'C' Calculator             ************            
*******************************************************************************/       

#include "p24FJ64GA006.h"
#include "calc.h"
#include "stddef.h"
#include "math.h"
#include "stdlib.h"
#include "string.h"

_CONFIG1(FWDTEN_OFF);
_CONFIG2(FNOSC_FRC&POSCMOD_NONE);

//Variables
static FLOAT lvalue = 0;
static FLOAT rvalue = 0;
static CHAR lastop;

⬇ Download file

Complete Source Code

Proteus Simulation

In Proteus simulation, the system behaves like a real calculator:

  • Pressing keypad buttons inputs numbers/operators
  • LCD updates instantly with typed values
  • On pressing =, result is displayed
  • Error message appears for invalid operations

This makes it an excellent virtual testing environment before hardware implementation.

Conclusion

This PIC24 calculator project is a solid example of combining Proteus simulation, keypad interfacing, and LCD control in embedded systems. It demonstrates real-world firmware design, modular coding, and hardware interaction.

Whether you’re learning or building practical DIY electronics, this project provides a strong foundation in microcontroller-based system design.

Complete File

⬇ Download file

Calculator Test using PIC24FJ64GA006 with Proteus Simulation

  • What components are required for the calculator project?
    The project uses a PIC24FJ64GA006 microcontroller, a 16x2 LCD, a 4x4 matrix keypad, pull-up resistors, diodes, and a power supply.
  • How does the system handle user input?
    The system continuously scans the 4x4 matrix keypad where rows are driven by the MCU and columns are read with pull-up resistors.
  • Can the calculator perform division by zero?
    No, the system includes error handling that displays an error message when division by zero is attempted.
  • Does the calculator support floating-point numbers?
    Yes, the calculator engine handles floating-point number inputs and calculations.
  • Which software is used to simulate this project?
    The project is designed using EASYHDL and simulated in Proteus VSM.
  • What happens when the equals button is pressed?
    When = is pressed, the system computes the result based on stored operands and operators and updates the display instantly.
  • How is the LCD controlled in the code?
    LCD commands and data are sent via PORTD, which handles the busy flag and display control.
  • What types of arithmetic operations are supported?
    The calculator supports addition, subtraction, multiplication, and division operations.
Programmers & ICSP

PID Controlled Oven using TMS320F28027PT with Proteus Simulation

IntroductionThis project demonstrates a PID controlled oven implemented using a PICCOLO TMS320F28027PT microcontroller and verified through Proteus simulation.It is a practical microcontroller...

Programmers & ICSP

PICCOLO Motor Controller Sample Design using TMS320F28023PT with Proteus Simulation

IntroductionThis project demonstrates a PICCOLO motor controller sample design implemented using the TMS320F28023PT Piccolo microcontroller and tested through Proteus simulation. It focuses...

Programmers & ICSP · PIC16F84A

PIC Musical Doorbell using PIC16F84A with Proteus Simulation

IntroductionThis microcontroller project demonstrates a musical doorbell built around a PIC16F84A and a simple piezo sounder.Using two push buttons, the system allows...

Programmers & ICSP · PIC16F877A

EPE PIC/LCD Demo using PIC16F877 with Proteus Simulation

IntroductionThe EPE PIC/LCD Demo is a classic microcontroller project that demonstrates how a PIC16F877 can fully control a PG12864F graphical LCD.Designed as...

Programmers & ICSP · PIC16F628A

DHT11 Low Cost Humidity Sensor using PIC16F628A with Proteus Simulation

IntroductionThis microcontroller project demonstrates how to interface a low-cost DHT11 temperature and humidity sensor with a PIC16F628A using a Proteus simulation environment.The...

Programmers & ICSP

PIC12 ADC Converter using PIC12C671 with Proteus Simulation

IntroductionThe PIC12 ADC Converter project demonstrates how the built-in analog-to-digital converter (ADC) of the PIC12C671 microcontroller works in a practical setup.An analog...

Ibrar Ayyub

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough...