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:
 

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

Cookies are required to use this site. You must accept them to continue using the site. Learn more…