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.

Timer problem with Rigel Reads51

Status
Not open for further replies.

joajas

Junior Member level 1
Joined
Jul 17, 2004
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
176
using lcall in reads51

Hi, I am trying to assemble the following, but I keep getting error. Please help. Thanks.

#include <sfr51.inc>

ORG OOOOH
LJMP MAIN
ORG 0100H

MAIN: MOV R6,#60D
MOV TMOD,#10H
MOV R1,#100D

NEXT: MOV TH1,#B1H
MOV TL1,#E0H
SETB TR1

WAIT1: JNB TF1, WAIT1
CLR TR1
CLR TF1
DJNZ R1, NEXT
LJMP HERE

HERE: LJMP HERE

END



Error Messages:
"E:\timer test1.asm" 13 Undecodable line, Syntax error
"E:\timer test1.asm" 16 Undecodable line, Syntax error
"E:\timer test1.asm" 23 Incorrect operand types
 

delay in reads51

TF1 as Timer1 overflow flag is set by hardware when Timer 1 overflows and is cleared by hardware as processor vectors to th interrupt service routine.
Trying to set/clear it by software will cause errors ..

In some assemblers/compilers numbers bigger than 9Fh should be represented as 0E0h, 0B2h etc ..
 

    joajas

    Points: 2
    Helpful Answer Positive Rating
reads51 error when use tmod

Tried to remove the clr tf1 code, but still generate the same result.
 

rigel reads51

Try to change ORG OOOOh to 0000h ..
Here is your program as LST file:
1 $NOPAGING
2 $MOD252
3
0000 4 ORG 0000h
0000 020100 5 LJMP MAIN
0100 6 ORG 0100h
7
0100 7E3C 8 MAIN: MOV R6,#60d
0102 758910 9 MOV TMOD,#10h
0105 7964 10 MOV R1,#100d
11
0107 758DB1 12 NEXT: MOV TH1,#0B1h
010A 758BE0 13 MOV TL1,#0E0h
010D D28E 14 SETB TR1
15
010F 308FFD 16 WAIT1: JNB TF1, WAIT1
0112 C28E 17 CLR TR1
0114 C28F 18 CLR TF1
0116 D9EF 19 DJNZ R1, NEXT
0118 02011B 20 LJMP HERE
21
011B 02011B 22 HERE: LJMP HERE
23
24 END
25

VERSION 1.2h ASSEMBLY COMPLETE, 0 ERRORS FOUND
HERE . . . . . . . . . . . . . . C ADDR 011BH
MAIN . . . . . . . . . . . . . . C ADDR 0100H
NEXT . . . . . . . . . . . . . . C ADDR 0107H
TF1. . . . . . . . . . . . . . . B ADDR 008FH PREDEFINED
TH1. . . . . . . . . . . . . . . D ADDR 008DH PREDEFINED
TL1. . . . . . . . . . . . . . . D ADDR 008BH PREDEFINED
TMOD . . . . . . . . . . . . . . D ADDR 0089H PREDEFINED
TR1. . . . . . . . . . . . . . . B ADDR 008EH PREDEFINED
WAIT1. . . . . . . . . . . . . . C ADDR 010FH
 

reads 51

Sorry about that typo error, but that is not the problem. There is no such error in my actual code. Had reconfirmed by typing over with zero. Still has the same problem, please advice.
 

undecodable line, syntax error

Besides these small things there is no error in your code, as you can see in the quoted LST file (previous post).
I don't use Rigel Reads51, but it looks like it doesn't "like" correct structures ??!! or maybe it doesn't recognize symbols such as TR1, TF1 ..
 

Re: Timer problem(solved), new interrupt problem.

Hi, sorry to trouble you, but I have got the problem sloved. Looks like the software does not handle values in formats other than hex. I changed the decimals to hex format, it assembles without problem.

Thanks for your help.

I have got another problem here.

When I run the code on the actual hardware. The controller interrupt always trigger twice when I press the interrupt trigger button once, or when I do a hardware reset. Below is the code. Please advice how I can overcome this problem, thanks.

I am using a Atmel 89S51 controller with some leds and couple of push buttons.


#include <sfr51.inc>

ORG 0000H
LJMP MAIN

ORG 0100H
MAIN: SETB EA ;ENABLE EXTERNAL INTERRUPT 0 AND INTERRUPT 1
SETB EX1
SETB IT0 ;SET TO EDGE TRIGGERED (NEGATIVE EDGE)
SETB IT1 ;SET TO EDGE TRIGGERED (NEGATIVE EDGE)

HERE: LJMP HERE

EX0_ISR: MOV P2,#FFH
LCALL DELAY
CLR P2.2
LCALL DELAY
CLR P2.3
LCALL DELAY
CLR P2.4
LCALL DELAY
RET


DELAY: MOV TMOD,#10H
MOV R0,#1EH

NEXT: MOV TH1,#B1H
MOV TL1,#E0H
SETB TR1

WAIT1: JNB TF1, WAIT1
CLR TR1
CLR TF1
DJNZ R0, NEXT
RET

ORG 0013H
LCALL EX0_ISR
RETI
END
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top