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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/06/02 03:33
Read: times


 
#23978 - question about pointer with DB reference
Dear all,
The things I would like to do will illustrate below:
For example, I have a set of database:

E: DB 00H, 00H, 24H, 24H, 24H, 3CH
H: DB 00H, 00H, E7H, E7H, 00H, 00H
D: DB 0FH, F0H, A4H, 4AH, 2BH, BCH

WD: DB "EH"

Let me explain the aim of database first, E, H are store the display pattern of the letter E and H. While WD is stored the order of letter display, in this example, I would like to read #E first, then #H.
I would like to ask whether it is possible to use table (#WD) to make the pointer (DPTR) to #E, etc?

Here is the program I have tried to implement.. but I don't know how to refer the data in #WD to the table #E.
--------------------------------------------
CNT EQU 30H
OFFSET EQU 31H

ORG 00H
SJMP START
START: ACALL INIT

INIT: MOV CNT, #3
MOV OFFSET, #0
SCAN0: MOV A, P2
CJNE A, #FFH, SCAN1
SJMP PATTERN0
SCAN1: CJNE A, #F4H, SCAN2
; SJMP PATTERN1
SCAN2: CJNE A, #4FH, SCAN0
; SJMP PATTERN2

PATTERN0: MOV R3, #6
MOV DPTR, #WD1
MOV A, OFFSET
MOVC A, @A+DPTR
INC OFFSET
;****** I don't know how to do at this row
MOV DPTR, #E ;I would like to point to #E
LOOP0: MOV A, #0
MOVC A, @A+DPTR
MOV P1, A
INC DPTR
ACALL DELAY
ACALL DELAY
DJNZ R3, LOOP0
DJNZ CNT, PATTERN0

DELAY: MOV R6, #450
S1: MOV R7, #350
DJNZ R7, $
DJNZ R6, S1
RET


E: DB 00H, 00H, 24H, 24H, 24H, 3CH
D: DB 0FH, F0H, A4H, 4AH, 2BH, BCH
H: DB 00H, 00H, E7H, E7H, 00H, 00H
BLANK: DB FFH, FFH, FFH, FFH, FFH, FFH

WD1: DB "EDH"

END
-------------------------------------------
The concept I would like to implement is to get the order of display first, i.e.
MOV DPTR, #WD1
MOV A, OFFSET
MOVC A, @A+DPTR
As A is refering to E in the database of WD1, how to use A to set the pointer (DPTR) to table #E? --> like MOV DPTR, #E, BUT with the use of A.

Thnx... Thnx very much

Sunny CHU

List of 2 messages in thread
TopicAuthorDate
question about pointer with DB reference            01/01/70 00:00      
RE: question about pointer with DB refer            01/01/70 00:00      

Back to Subject List