Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/16/09 15:25
Read: times


 
#170873 - Test your code - at least with pen and paper
Responding to: ???'s previous message
Have you taken the time to read your code.

You have code like:
LJMP BCD_ASCII 
RET 

LJMP ADR_RES 
RET 

When you do a jump (not call) to BCD_ASCII - how do you expect to process the RET instruction?

BCD_ASCII: ; (Convert BCD to ASCII
MOV A, R0 
ADD A, #30H 
MOV A, R1 
ADD A, #30H 
MOV A, R2 
ADD A, #30H 

How much data can you fit in A? Don't you think that you have to emit the contents of A before using A for processing the next digit?

ADR_RES: ;(MOV each digit of time to address in RAM) 
MOV A, RO   ; <== OOPS why that is not the digit zero. It's a letter.
MOV A, #30h 
MOV A, R1 
MOV A, #31h 
MOV A, R2 
MOV A, #32h 
RET 


If you mix characters and digits - have you really tested your code?
And this code is basically a copy-paste of the BIN_BCD - with the exception that there isn't a LJMP BIN_BCD at the end.

Another thing. SOme parts of your code uses R0, R1 and R2. Other parts uses R1, R2, R3. How will the processor know that you have a hard time with zero or one-relative indices?

List of 18 messages in thread
TopicAuthorDate
Convert Binary numbers to symbols to show on a lcd.            01/01/70 00:00      
   Have you considered searching?            01/01/70 00:00      
      BCD?            01/01/70 00:00      
         Quite sure ASCII            01/01/70 00:00      
            Yes, BCD            01/01/70 00:00      
   Language dependent            01/01/70 00:00      
      The *techniques* are not language-dependent            01/01/70 00:00      
   Binary to BCD to ascii Assembly code 8051            01/01/70 00:00      
      Step by step...            01/01/70 00:00      
         Attempt to fix code            01/01/70 00:00      
            What Assembler? What Simulator?            01/01/70 00:00      
               EdSim51            01/01/70 00:00      
            please comment and format your "code"            01/01/70 00:00      
            Test your code - at least with pen and paper            01/01/70 00:00      
      Not strictly true            01/01/70 00:00      
      start with C, optimize generated asm later?            01/01/70 00:00      
         That still requires...            01/01/70 00:00      
         Misplaced focus?            01/01/70 00:00      

Back to Subject List