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 17:00
Read: times


 
#165512 - Problems writing a string on serial
My main question is how can i write a string(i.e. "string1") on a serial without having to save each ascii code at a separate adress?

I tried doing something like this:


jmp start

org 0023H
acall serial
reti

org 0050H
start:
mov TMOD,#20H
mov TCON,#40H
mov TH1,#0F7H 
mov PCON,#80H
mov SCON,#50H
mov IE,#90H
printstop: bit 0
clr printstop
sir1: db "Window$"   string i want to write
sir2: db "Window1$"

main:
jb printstop,exit
setb printstop
mov dptr,#sir1
mov R1,#00H
acall print
exit:
jmp loop1

print:
mov A,R1
movc A,@A+dptr
cjne A,#"$",print_ok
clr printstop
jmp printexit
print_ok:
inc R1
mov SBUF,A
loop:
jnb SCON.1,loop
printexit:
ret

serial:
jb SCON.1,output
jmp serialexit
output:
clr SCON.1
acall print
serialexit:
ret

loop1:
jmp loop1
end

 


You will probably think it's pretty ok and you're right the only problem is that it doesn't what to write everything.
For example if i try to write "pisu" it doesn't work it's just skipping all the program and always returning to the "jmp start" command, and also when I look at the source were the string should be there are only blank spaces and this command :"jmp A+dptr" wich initialy are both 00h and that's why it always jump back to the first command "jmp start".

If anyone had this problem before please don't hesitate to give you're advice.

Thank you


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