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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/06/07 08:24
Read: times


 
#142805 - Comment help the author, too!
Responding to: ???'s previous message
Salim C. Andraos said:
in 'mov SCON, #50h' where does the 50 come from? i understand what its suppose to do. setting bits 4 and 6, 8-bit uart, etc. but how does it add up to 50hex?

Comment it clearly to make it obvious; eg,
mov SCON, #50h  ; 50h = 0101 0000
                ;        ^ ^
                ;        | |
                ;        | +-- Set bit 4
                ;        +---- Set bit 6

Most assemblers allow you to use binary notation directly - which would make more sense here ('C' doesn't allow binary notation, so 'C' authors have no choice but to use hex).

Better still would be to use symbolic constants rather than "magic numbers"...




List of 9 messages in thread
TopicAuthorDate
in 'mov SCON, #50h' where does the 50 come from?            01/01/70 00:00      
   Simple hex/binary arithmetics            01/01/70 00:00      
      or, rather than add            01/01/70 00:00      
   Comment help the author, too!            01/01/70 00:00      
      That would be the Standards Committe            01/01/70 00:00      
      this is how I do it            01/01/70 00:00      
         As Jan Said            01/01/70 00:00      
   Like this            01/01/70 00:00      
   Thanks for the hlp            01/01/70 00:00      

Back to Subject List