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

Pointer pointing at the wrong data

hi all,

I've been trying to send a prefixed data to my 8051 TXD vt the following command:


ORG 000H
LJMP SETUP

ORG 003H ;External Interrupt 0
CLR P3.6
LCALL EXT_INTERRUPT
RETI

ORG 00BH ;Timer Interrupt 0
LJMP TIMER_INT

ORG 023H ;serial interrupt
LCALL SERIAL_INT
RETI

CSEG AT 0100H
KEY: DB "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
NUM: DB "0123456789"
TXT: DB "HELLO WORLD]"



SERIAL_INT:

JNB RI,TRANS ;jump to transmit section if serial interrupt is by transmission
CLR EX0 ;disable External Interrupt 0
CLR ET0 ;disable Timer Interrupt 0
MOV A,SBUF ;accumulator acts as temp storage for received character, A stands for accumulator
CLR RI ;clear the serial interrupt flag

CJNE R2,#0,CHECK_END ;check for start of pager message header else check for message trailer
CJNE A,#'@',SKIP ;skip message if it is not a correct header
INC R2 ;increment counter to 1

MOV DPTR,#S_MSG ;load data pointer to S_MSG's address
MOV R0,DPL ;load address of S_MSG to R3
TRANS:
MOV DPTR,#TXT ;load data pointer to TXT's address
MOV R0,DPL
LJMP SEND_TO_TXD
CLR TI
RET

SEND_TO_TXD:
CLR TI
MOV SBUF,@R0 ;TESTING: LOAD THE FIRST CHAR OF TXT
INC R0
JNB TI,$
CJNE @R0,#']',SEND_TO_TXD



--------------------------------------------

the results shown on my hyperterminal kept pointing to data defined in the followings:


------------------------------------
;Device 1 Memory Contents
;------------------------
D1ADDED: DS 1
D1ACT: DS 1
D1NAME: DS 5
D1PASS: DS 5
D1PORT: DS 1
D1STATE: DS 1
D1HOUR_OFF: DS 1
D1MIN_OFF: DS 1
D1HOUR_ON: DS 1
D1MIN_ON: DS 1

.
.
.
.
.
;Device 5 Memory Contents
;------------------------
D5ADDED: DS 1

.
.
.
.;Default Device 1 Memory Contents
;--------------------------------
MOV DPTR,#D1ADDED
MOV R0,DPL
MOV @R0,#'Y'

MOV DPTR,#D1ACT
MOV R0,DPL
MOV @R0,#'Y'

MOV DPTR,#D1NAME
MOV R0,DPL
MOV @R0,#'O'
INC R0
MOV @R0,#'V'
INC R0
MOV @R0,#'E'
INC R0
MOV @R0,#'N'
INC R0
MOV @R0,#'1'

MOV DPTR,#D1PASS
MOV R0,DPL
MOV @R0,#'B'
INC R0
MOV @R0,#'B'
INC R0
MOV @R0,#'B'
INC R0
MOV @R0,#'B'
INC R0
MOV @R0,#'B'

.
.
.
.


+++++++++display on hyperterminal

YYOVEN1BBBBB1N YYBULB2BBBBB.....

+++++++++++++++++++++++++++++++++++++++

My question is, how do i transfer the message 'Hello World' (defined by TXT)to SBUF?

0