Firstly, there are a couple of things to make your code easier for you to read and less likely to cause problems in the future.
1) Use "W" or "F" as the destination for instructions. They mean the same as 0 and 1 in this case but it makes it easier to see what is going on.
2)Don't use W0, W1 etc as register names, as they have specific meanings on the 24F series PICs. Use more meaningful names like temperature1, voltage3 etc.
If you want to add 5 numbers, do you should add 5 numbers not 7
Code:
addwf W0,0
addwf W1,0
addwf W2,0
addwf W3,0
addwf W4,0
addwf W5,0
movwf LEDON
This adds the wreg to W0, W1, W2, W3, W4 and W5. That is 7 numbers. The first line adds in whatever is in the working register at the start.
If you want to add W0, W1, W2, W3, and W4 (which are 5 numbers) you should use:-
Code:
movf W0, w
addwf W1, w
addwf W2, w
addwf W3, w
addwf W4, w
movwf LEDON
That will roll over if the sum of W0:W4 is more than 255
If you want to keep the total, you could use something like:-
Code:
clrf top_byte_reg
movf w0, w
addwf w1, w
btfsc status, C
incf top_byte_reg, f
addwf w2, w
btfsc status, C
incf top_byte_reg, f
addwf w3, w
btfsc status, C
incf top_byte_reg, f
addwf w4, w
btfsc status, C
incf top_byte_reg, f
movwf bottom_byte_reg
On each addition there can be an overflow. The carry bit is set if that happens, and the number of times that happens is added up in top_byte_reg
There are loads of routines in:-
**broken link removed**