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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/20/09 19:52
Read: times


 
#165516 - First off, write neat code
Responding to: ???'s previous message
You will find everything easier if you write with spaces:

Then you need to write a function to send one character.

putchar:                 ; char in A
     mov SBUF,A
loop:
     jnb SCON.1,loop
     ret
 


Then write one to send a whole string

putstring:               ; address of string in DPTR, destroys A
     clr  A
     movc A,@A+DPTR
     inc  DPTR
     cjne A,#'$',putstr1
     ret
putstr1:
     acall putchar
     ljmp putstring     

 


There are many ways of writing simple functions, but you just need to think of what parameters you send, what the function may return, and what registers it may alter. e.g. you may prefer to keep DPTR and use say R1.

David.

List of 3 messages in thread
TopicAuthorDate
Problems writing a string on serial            01/01/70 00:00      
   you have a far better chance            01/01/70 00:00      
   First off, write neat code            01/01/70 00:00      

Back to Subject List