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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/12/05 08:43
Read: times


 
#89525 - Not quite
Responding to: ???'s previous message
It turns out you're complicating the problem more than necessary. You're doing two different divisions to get the two ASCII bytes and the second operation is incorrectly implemented.

Rather than correct the code you've got, try this:

DISPLAY_SECONDS:
  MOV B,#10
  DIV AB
  ADD A,#30h
  LCALL WRITE_TEXT
  MOV A,B
  ADD A,#30h
  LCALL WRITE_TEXT
  RET
trick: 
  LCALL INIT_LCD 
  LCALL CLEAR_LCD 
  MOV A, SECONDS 
  LCALL DISPLAY_SECONDS 


That's all you should need. Remember that DIV AB puts the integer result of the division in the accumulator and leaves the remainder in B. So if the number in question were 38 seconds then A=38, B=10. After DIV AB, A=3 and B=8. You immediately add 30h to the accumulator which gives you 33h which is the ASCII value for '3' and you send that to the LCD. You then move B (08) to the accumulator, add 30h which gives you 38h which is the ASCII value for '8', and you send that to the LCD.

And that's it.

Regards,
Craig Steiner


List of 13 messages in thread
TopicAuthorDate
Writing 8bits binary number to LCD?            01/01/70 00:00      
   Re: Writing 8 bits to LCD.            01/01/70 00:00      
   Nope            01/01/70 00:00      
      0-9 = ok. 10+ = problem O_o            01/01/70 00:00      
         Not quite            01/01/70 00:00      
   Re:            01/01/70 00:00      
      News to me !            01/01/70 00:00      
         Re:News to me!            01/01/70 00:00      
            Pascal compilers.            01/01/70 00:00      
            Not Pinnacle            01/01/70 00:00      
      Unlikely            01/01/70 00:00      
         Y'think?            01/01/70 00:00      
            Sad, but true... :-(            01/01/70 00:00      

Back to Subject List