hi vikram_n_99,
i feel that you might have misunderstood the concept of "INTERRUPT", b'coz you said that "main program checks for interrupt from serial port for a period of 3seconds" This is a small example. if i've enabled the serial receive, timer 0 , intr0, intr1 and the maiin routine will do some operation. so alltogether i would have written four separate programs (3 interrupt service routines and 1 main program). I've mentioned as interrupt service routines it means that those routines/ programs will be executed only upon the specified interrupts only (preferably terminated by "RETI meaning Return from Interrupt") and i feel that you need not wait for an interrupt and continue with your task in the main program.if you've enabled the Interrupt then once it comes the MCU will automatically execute the program written in the location for ISR.for instance 0023h is the location where the program jumps if you'd enabled serial receive and will execute the instruction written in the location 0023h.
i would better suggest that for every ISR you make it a habit to write a subroutine, like this. open the ".lst" file of your program and check the location of the start of your code.
0003h
lcall timer_0_ISR
reti
000bh
lcall intr_0_ISR
reti
0013h
lcall timer_1_ISR
reti
001bh
lcall intr_1_ISR
reti
Coming to the next problem, you mentioned MAX220. i feel that you are going for RS-422 communication which is two wire, but the 89c52 supports only RS-232 Communication (which needs three wire). i haven't connected like this before. will it work . i guess it will not. if its a typing mistake then leave it, if you've misplaced then try MAX232.
regards,
saha
i feel that you might have misunderstood the concept of "INTERRUPT", b'coz you said that "main program checks for interrupt from serial port for a period of 3seconds" This is a small example. if i've enabled the serial receive, timer 0 , intr0, intr1 and the maiin routine will do some operation. so alltogether i would have written four separate programs (3 interrupt service routines and 1 main program). I've mentioned as interrupt service routines it means that those routines/ programs will be executed only upon the specified interrupts only (preferably terminated by "RETI meaning Return from Interrupt") and i feel that you need not wait for an interrupt and continue with your task in the main program.if you've enabled the Interrupt then once it comes the MCU will automatically execute the program written in the location for ISR.for instance 0023h is the location where the program jumps if you'd enabled serial receive and will execute the instruction written in the location 0023h.
i would better suggest that for every ISR you make it a habit to write a subroutine, like this. open the ".lst" file of your program and check the location of the start of your code.
0003h
lcall timer_0_ISR
reti
000bh
lcall intr_0_ISR
reti
0013h
lcall timer_1_ISR
reti
001bh
lcall intr_1_ISR
reti
Coming to the next problem, you mentioned MAX220. i feel that you are going for RS-422 communication which is two wire, but the 89c52 supports only RS-232 Communication (which needs three wire). i haven't connected like this before. will it work . i guess it will not. if its a typing mistake then leave it, if you've misplaced then try MAX232.
regards,
saha