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

Back to Subject List

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


 
#119859 - I solved the problem for Serial Comm
Responding to: ???'s previous message
Hi. Thank you Neil. I hope someone will be helped with this answer.

I changed the lines and checked TI. I also changed R0 to R1 because it appeared in the delay loop and used R2 for another delay instead of R0 two times.

Now, the code displays letter 'e' goes to delay and return to display letter 'e' and so on.

The goal for this code is to understand how to use TI, SBUF, congigure UART and display a character.

If you need an easy code to test your serial comm hardware, just copy-paste it.

Run hyperterminal.. well I used Terminal by Bray (as recommended at 5082.com) and watch letter e appears on the screen.

MOV SCON,#01010010B
MOV TH1, #0FDH
MOV TCON,#01000000B
MOV TMOD,#00100000B

mov R1, #65h ; assigned letter 'e' with ASCII

START:
JNB TI, START ; Test TI
CLR TI ; Buffer is clean you can use it
MOV A, R1
MOV SBUF, A ; write A to SBUF (Starts sending)
ACALL retardo ; delay
SJMP START ; here we go again

retardo:
djnz R0, retardo ; decrement and jump if not zero
djnz R2, retardo ; both counts from 255 to 0
ret

I hope this is useful to you....

I wish you errors in your programs and hope you post your questions and solutions... :-)


List of 7 messages in thread
TopicAuthorDate
Serail Com codes            01/01/70 00:00      
   How do you Know            01/01/70 00:00      
   I solved the problem for Serial Comm            01/01/70 00:00      
   Delay            01/01/70 00:00      
      Sorry David, that's not correct.            01/01/70 00:00      
         Delay correct            01/01/70 00:00      
         David referred to...            01/01/70 00:00      

Back to Subject List