Re: Interrupts problem
This is my code :I
ORG 0h
jmp start
;---------------------------------------------------------------
;Interrupt Service Routine
ORG 03h
reti
;ORG 0BH ;timer 0 interrupt
;RETI
ORG 13H ;external interrupt 1
RETI
ORG 1BH ;timer 1 interrupt
RETI
ORG 23H ;serial port interrupt
JMP SER_READ
RETI
;--------------------------------------------------------
ORG 30H
INITIALIZE:
MOV IE, #00H
MOV TH1, #0FDH ;Set up for 9600 baud rate
MOV SCON, #050H ;50h ;Mode = 8 bit UART
MOV TMOD, #021H ;Sets Timer1 to 8 bit auto reload
MOV TCON, #050H ;Turns Timer1 on
MOV TH0,#0feH
MOV TL0,#00CH
CLR RI
RET
start: clr p3.4
ACALL INITIALIZE
CPL P3.7
SETB TR0
RUN:SJMP RUN
mov r0,#02h
begin: nop ;mov r2,#0a0h
clr p3.5
;clr p3.7
clr p3.4
MOV IE, #10010000B ; IE Setting Serial Interupt
MOV R0, #04H ; STARTING ADDRESS OF THE TEMP STORE
MOV R7, #02H ; 2BYTES HAVE TO READ 8 + 8
SETB C
MOV PCON, #01H
CON_LOOP:
JMP CON_LOOP
SER_READ:
;MOV IP, #00010000B; Priority for serial interrupt
ACALL READ
ACALL SEND
END_RETI:
RETI
END_2_RETI:
MOV IE, #00H
CLR C
RETI
READ:
CLR RI ;-
WAIT1: JNB RI, WAIT1 ;-
; MOV @R0, #0FH
MOV @R0, SBUF ; down counter number to be loaded
MOV A,SBUF
;ANL A,#00111111B
;RL A
;RL A
MOV P1,A
RET
SEND:
MOV SBUF, @R0
WAIT: JNB TI, WAIT ;-
CLR TI ;-
;MOV SBUF, #'a'
RET
END;
P.S. sorry no sufficient time to make a flow chart