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.

whats wrong with my assembly code?

Status
Not open for further replies.

sign up

Newbie level 6
Newbie level 6
Joined
May 13, 2011
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,385
Contents are temperory under editing...
 
Last edited:

Apart from some likely syntax errors, the biggest problem is a total lack of any information on what it does, which processor you are using, which assembler you are using and what errors you are seeing.
Give us some clues then we might be able to help.

Brian.
 

hi, please have a look on my codes, i have edited and added more detail infromations
 

I think the problem is with the instruction "ADDWF sum, sum".
ADDWF adds the value in the instruction to its existing value and either stores the result in W or back in the source register. The source register can be defined as '0' to store the value in W or '1' to store it in the source register but not as 'sum' which is an address value.
Try changing it to "ADDWF sum,1" or "ADDWF sum,f" and see if that fixes it.

Brian.
 

I think the problem is with the instruction "ADDWF sum, sum".
ADDWF adds the value in the instruction to its existing value and either stores the result in W or back in the source register. The source register can be defined as '0' to store the value in W or '1' to store it in the source register but not as 'sum' which is an address value.
Try changing it to "ADDWF sum,1" or "ADDWF sum,f" and see if that fixes it.

Brian.

hi, unfortunately the problem remains unsolve. i still not manage to display the output of the addition of two input numbers.

"#" represents "addition operation"

when i press "1", "#","2"---> it show "4" as output, even though i change other inputs, but the ouput always display "4". Any idea?
 

RETLW returns a constant value not a variable. I guess that the line "RETLW sum" is returning the address of 'sum' rather than the value in it. Make sure the result is stored in W (ADDWF sum,0) then use a normal return instruction. The value you want will already be in the W register so RETLW is not the correct instruction to use.

Let me know how you get on.

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top