| ??? 02/08/02 18:06 Read: times |
#19563 - RE: I summary |
I agree with everything that's been recommended. In summary:
1. You don't have a "main" loop that cycles. Executing your program, since it has no main loop, will fall right into the interrupt service routine and execute it. That's bad. 2. Your interrupt service routine doesn't clear RI nor TI. It will execute over and over again until you clear those bits. In addition: 3. Your ISR is not protecting the PSW register. Your CJNE instruction may end up modifying the value of the carry bit which, in a normal ISR in virtually any program, is a bad thing. You should PUSH PSW onto the stack at the beginning of the ISR and POP PSW at the end. 4. Your ISR is modifying the value of the accumulator. This might be ok just for a test, but an ISR normally should not modify the value of any register without protecting it. Instead of incrementing the accumulator you should be incrementing the value of an Internal RAM address, and writing that value to SBUF. Otherwise, if you using the Accumulator outside of the ISR you are going to get unpreditable results. Craig Steiner |



