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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/21/02 14:31
Read: times


 
#18937 - RE: assembly code check
Please review the 8051 Tutorial on "indirct addressing."
When I suggested you redefine R0 or R1 as MSG4 all you are doing is giving R0 or R1 a name you would rather use. It is done with a simple Equate statement such as:
MSG4 EQU R0 ;give R0 another name

The code you propose;

org 50h
msg4: db (16), 0

will still leave you in code (or program) memory. You want MSG4 to be in Internal Ram memory. Having renamed R0 as above you need to set MSG4 to 50h with the command:
MOV MSG4,#50h ;Point index register R0 to ram location 50h

To store an incoming character from SBUF use the command:
MOV @MSG4,SBUF ;save in next Ram location

This will store the contents of SBUF to the ram location pointed to by MSG4 (R0).
Increment MSG4 each time you store a byte during receive. To display what has been received simply reset MSG4 to 50h and start retrieving the message with the command:
MOV A,@MSG4 ;get next character to display

and again increment MSG4 each time a character is retrieved.

Good luck,

Hal



List of 18 messages in thread
TopicAuthorDate
assembly code check            01/01/70 00:00      
RE: Use real FULL name            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      
RE: assembly code check            01/01/70 00:00      

Back to Subject List