??? 08/09/11 05:04 Read: times |
#183269 - Attention to Details Responding to: ???'s previous message |
When writing code in assembly language it is extremely necessary to pay a lot of attention to details. Here I've taken just one of your routines and marked it up for all the things wrong with it.
BIN_DEC_CONVRT: MOV R0, #RAM_ADDR ****MOV A, P2 <--- This does not make real sense to get tbe number to convert from P2 where the LEDs are connected. I suggest getting the actual value that needs to be comverted. ****MOV B, #10 <--- This is wrong. This should be "MOV B, #100" DIV AB ****MOV @R0, B <--- This should be "MOV @R0, A" to store the number of 100s to first buffer location. INC R0 **** <--- Missing here "MOV A, B" to get the previous remainder ready for the divide by 10. MOV B, #10 DIV AB ****MOV @R0, B <--- Here you want to change this to "MOV @R0, A" so as to store the number of 10s to secomd buffer location. INC R0 ****MOV @R0, A <--- Wrong here. Change to "MOV @R0, B" to be saving final number of 1s at third position of the buffer. RET Michael Karas |
Topic | Author | Date |
need help to display timer count on hyperterminal and LED'S | 01/01/70 00:00 | |
Attention to Details | 01/01/70 00:00 | |
divide by 10 | 01/01/70 00:00 | |
Hundredth digit is quotient of division by 100 | 01/01/70 00:00 | |
thanks | 01/01/70 00:00 | |
Debugged with pen and paper? | 01/01/70 00:00 | |
Debugged | 01/01/70 00:00 | |
Decimal or hexadecimal? | 01/01/70 00:00 | |
decision | 01/01/70 00:00 | |
So take up the challenge then | 01/01/70 00:00 | |
agreed | 01/01/70 00:00 | |
Actually BCD!! | 01/01/70 00:00 | |
Oh Details Details | 01/01/70 00:00 | |
update | 01/01/70 00:00 | |
Issues | 01/01/70 00:00 | |
better to check before sending | 01/01/70 00:00 | |
Even Better.... | 01/01/70 00:00 |