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.

Help:serial interrupt can't work (assembly)

Status
Not open for further replies.

jamesa

Newbie level 6
Joined
Jul 7, 2006
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,357
please help me check which part of my code got wrong??
and why my serial intterupt can't work ??
thx

ORG 0000H
LJMP MAIN
;====================================
;INT INTERRUPT
;====================================
ORG 0013H
CJNE R2, #14,KK1
CLR P2.1
RETI
KK1: RETI

ORG 0023H
LJMP SERIAL
;============================
;MAIN ROUTINE
;============================
ORG 30H
MAIN: MOV P1, #0FFH
MOV P0, #000H
CLR P2.1
CLR P2.2
MOV R2, #0
MOV R3, #0

MOV TMOD, #20H
MOV TH1, #-24
MOV SCON, #50H
MOV IE, #10010100B
SETB R1

B1: JB P1.1, B2
CLR P2.1
LCALL DELAY
CLR P2.2
SJMP B1

B2: JB P1.2, M1
SETB P2.2
LCALL DELAY
LJMP B1

M1: JNB P3.3 B1
INC R2
INC R3
MOV A,R3
MOV SBUF,A
LJMP B1

;==========================
;SERIAL INTERRUPT
;=========================
ORG 100H
SERIAL: JB TI,MM2
MOV A,SBUF

POW1: CJNE A,#41H,POW2
SETB P2.1
LCALL DELAY
LJMP MM1

POW2: CJNE A,#42H,CW
CLR P2.1
LCALL DELAY
LJMP MM1

CW: CJNE A,#43H,CWW
SETB P2.2
LCALL DELAY
LJMP MM1

CWW: CLR P2.2
LCALL DELAY
LJMP MM1

MM1: CLR RI
RETI

MM2: CLR TI
RETI



DELAY: MOV R5,#250
LOOP:
NOP
NOP
NOP
DJNZ R5,LOOP

RET
END
 

You haven't enable the interrupt mechanism

Code:
     SETB EA
     SETB ES
 

budhy said:
You haven't enable the interrupt mechanism

Code:
     SETB EA
     SETB ES

I think jamesa have do it with the syntax

MOV IE, #10010100B

jamesa, you should check the syntax

SETB R1 ( it is byte not bit)

and also

M1: JNB P3.3 B1

the comma is forgotten
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top