This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to retrieve data from a DPTR(16 bits) when registers are only 8bits

Hi All,

I'm facing a problem with assembly coding here..

CSEG AT 0100H
LABEL:   DB  "TESTING TESTING 1 2 3]"

TRANS:
	MOV	DPTR,#LABEL	;load data pointer with LABEL's address
	MOV 	R0,DPL
	LJMP	SEND_TO_TXD
	CLR	TI
	RET

SEND_TO_TXD:
	CLR	TI
	MOV 	SBUF,@R0   			INC 	R0
	JNB	TI,$
	CJNE	@R0,#']',SEND_TO_TXD
	RET

I want to send the string of characters in LABEL to SBUF. But the above code cannot work because by loading DPL to R0, i'm only loading address 00H to R0 hence data transferred to SBUF will be data at address 00H instead of LABEL.

Assuming that addresses from 00H - FFH have all been used up and i can only define byte starting from 0100H, does anyone has any idea on how to move the data which DPTR is pointing to, to SBUF which can only takle in 8 bits at a time.

Parents
  • "Can characters defined under code segment simply be displayed like this?"

    No, the only (conventional) way to access code memory is using MOVC.

    "Is certain part of the memory only meant for code, and certain part only meant for data?"

    Yes, @RO (and @R1) only access internal data memory. MOVX is used to access memory classified as "external" data memory.

Reply
  • "Can characters defined under code segment simply be displayed like this?"

    No, the only (conventional) way to access code memory is using MOVC.

    "Is certain part of the memory only meant for code, and certain part only meant for data?"

    Yes, @RO (and @R1) only access internal data memory. MOVX is used to access memory classified as "external" data memory.

Children
No data