Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to write a simple asm for adding 2 numbers using PIC16f877?

Status
Not open for further replies.

deardeepa76

Junior Member level 3
Joined
Dec 8, 2011
Messages
29
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,491
I want to write a simple asm program for PIC 16F877 to add 2 numbers. I am using MPLab IDE

Please help me, I am trying to learn the basics

Reg,
Deepa
 

Assuming you are dealing with 8-bit integers, basically all you do is this:

Create a variable to hold the result, it should have an upper byte and a lower byte.
load the first number into W
add it to the lower result byte
load the second number into W
add it to the lower result byte
if the carry flag is set, increment the upper result byte.

The result is then in the upper and lower result bytes.

Brian.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top