About Interrupts please help :( :)

Status
Not open for further replies.
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
 

sry i have a practice of using O_O LOL sorry about that :} thats not the character. The character I enter s say 1,A,O single character at a particular time :}

Ok I got clear picture of what I need and its in other post Please reply to my other post :}
 

Re: Interrupts problem

from the code i guess its 8051 MCU, do the following
1. run timer for 1/1000th second and toggle any port pin after interrupt timer occurs. If timer can count less than the real count then make a static variable and divide the count like if count is 10000 then divide it like 10 * 1000. 10 will be static and 1000 count for timer register.
2. set the RS232 communication, enable serial interrupt for RX and TX, write interrupt routine which will disable respective interrupt flag and read or write the data.
develop and test both timer freq generator and RS232 separately, when u r done, integrate the code, after the integrated code works fine, u can use it as u wanted. I did not wrote the code since i use C instead of assembly, so cant help u in that regard.

hope that helps.
 

if you are using timer with out intterrupt you will not get get correct result
reason is that when your serial communication taking place at that time you misses your timer counting in that loop
please do use pwm for generation for frequency and you can use serial communication with or with out intterupt and your frequency generation will work independenly
 

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…