Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Creat a table in 8051

Status
Not open for further replies.

K-PAX

Newbie level 4
Joined
Dec 30, 2011
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,323
hi :cool: i want to create a table to get acces to numbers after a 1s delay can anybody help with this code?

cseg at 0h

START: MOV TMOD,#01H ;TIMER0 IN MODE 1
MOV TH0,# 0CH
MOV TL0,# 0A3H
SETB TR0 ; ENABLE TIMER 0
MOV R2,#20
ADD A,#TABELA
movC A,@A+PC

DELAY:JNB TF0,DELAY ;DELAY ROUTINE
CLR TF0 ; ERASE FLAG
DJNZ R2,DELAY ; TO CREATE 1S DELAY TIME

TABELA:
;movc a,@a+pc
;ret
DB 0CH ,0CFH , 50H , 42H, 83H, 22H ;0,1,2,3,4,5...



end

this work but don´t show the correct numbers in all of them miss a segment in the display
 
Last edited:

To use instruction MOVC A, @A+PC you need to place the DB values right below the RET instruction and pre-load A with the value starting (initially) from the first number ..
Then save the A-value in another register (Rx or B) and use it (increased) in the next iteration of the loop ..
Example:

Code:
Table:
INC A
MOV B, A
MOVC A, @A+PC
RET
DB 10h, 20h, 30h, 40h, 50h

To call this subroutine do the following:

Code:
MOV B, #00h
...
Del_Loop:
MOV R2, #20
MOV A, B
LCALL Table
…
…
DJNZ R2, Del_Loop

:wink:
IanP
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top