| ??? 12/18/03 04:34 Read: times |
#60918 - RE: asm programming Responding to: ???'s previous message |
There is an additional requirement that needs to be considered as well,....
1) As Raghu stated...the actial ISR routine can go most anyplace in the code space. 2) An interrupt vector needs to be programmed properly for the interrupt to function properly. Each interrupt class has a fixed memory address that is defined as the vector location. When an interrupt actually happens the processor actually starts fetching the instructions for the ISR at the vector location. It is common to place an LJMP instruction in 3 bytes right at the vector location that branches to the ISR code block, whereever you have chosen to place it. 3) The actual SFRs related to the interruot in question need to be set properly to enable the interrupt and and then the EA bit needs to be set,,,,then the interrupt can happen. Note that sometimes you will see that programmers will actually place the code for an ISR starting right at the interrupt vector address. This can lead to more efficient code becasue it shortens the ISR execution time by a small amount by eliminating the LJMP instruction. For some applications this is necessary if the clock speed is very slow or if the interupt response time needs to be in the order of a few bus cycles. However in general this is not a good practice for a number of reasons. 1) The interrupt vectors are actually defined to be rather close together for the various interrupts and so there is limited code space for ISRs that must fit in the space from one vector to the next. 2) Sometimes it is mistake or maybe intentional to make am ISR right at the vector that is longer then the available space. But then later along comes the programmer to later make an upgrade and try to use the interrupt that has its vector space covered with the ISR code of another interrupt....what a mess to straighten out. 3) It is far more modular to be able to re-use code blocks from project to project when the serial ISR can be put with the serial handling code for example instead of off in a interrupt vectors source file. 4) The LJMP method is how it is handled when you write in C code. So if you are mixing some C with Assembler it is wise to use the same interrupt vector models. Michael Karas |
| Topic | Author | Date |
| asm programming | 01/01/70 00:00 | |
| RE: asm programming | 01/01/70 00:00 | |
| RE: asm programming | 01/01/70 00:00 | |
| RE: asm programming | 01/01/70 00:00 | |
| RE: asm programming | 01/01/70 00:00 | |
| RE: asm programming | 01/01/70 00:00 | |
| Barking at a tree ? | 01/01/70 00:00 | |
RE: asm programming | 01/01/70 00:00 |



