??? 06/17/04 08:57 Read: times |
#72625 - RE: 89C51 external interrupts using Keil C51 Responding to: ???'s previous message |
Hi,
well, so many questions, let start to answer: 1. Do we need to enable and disable the interrupt in its ISR to prohibit it to interrupt unless its ISR is over. Generally, no, we don`t. In fact, 8051 hardware does not allow the same interrupt to be processed until its ISR is not done with RETI. By other words: new interrupt event will be detected but its ISR not be called as long as ISR of another interrupt with the same or highter prioriry is executed. BTW: the Edge-triggered external interrupt event if occurs, will be "latched" into IEx bit and so after RETI, the new ISR will be called. The Level-activated external interrupt event will not be "latched" and so after RETI, the new ISR will be called only if the low level still presents on input pin (or if you forgot to clear IEx bit inside ISR :) 2. It it necessary to specify the register bank ( using 1 ..... etc ) No, it is not. But it may help your compiler with better optimization in some cases (and eats 8 bytes of DATA memory space as well). 3. To set serial port baud rate do we need to set TCON regs , default C51 setting is sufficient or not. Indeed, if we use timer 1 as baud rate source then we need to set TCON (at least bit TR1) as well as TMOD (timer 1 mode), SCON and PCON (sometimes). In fact, you should never rely on default values and set them all manually during program initialization. It is "good programming" way. 4. Do I need to modify startup.a51 file for this code. I dunno. I have never touch that file. In fact, there are some "startup.a51" files Keil uses. Just look into yours and see what it does. As a rule, it just clears (x)data memory and inits Stack Pointer. Now about your code you have posted here. If it does not work then just look at result assembly code and compare with that working one. Another way is to run debugger and look at it step by step. BTW, I have already compiled and tested it in debugger. It does work, really. Regards, Oleg |
Topic | Author | Date |
Using 89C51 external interrupts | 01/01/70 00:00 | |
RE: Using 89C51 external interrupts | 01/01/70 00:00 | |
89C51 external interrupts using Keil C51 | 01/01/70 00:00 | |
RE: 89C51 external interrupts using Keil C51 | 01/01/70 00:00 | |
RE: 89C51 external interrupts using Keil C51 | 01/01/70 00:00 | |
RE: 89C51 external interrupts using Keil C51![]() | 01/01/70 00:00 | |
89C51 external interrupts using Keil C51 | 01/01/70 00:00 | |
RE: Using 89C51 external interrupts | 01/01/70 00:00 | |
RE: Using 89C51 external interrupts | 01/01/70 00:00 | |
RE: Using 89C51 external interrupts | 01/01/70 00:00 | |
Did you notice Olegs replies??? | 01/01/70 00:00 | |
RE: Using 89C51 external interrupts | 01/01/70 00:00 |