Beruflich Dokumente
Kultur Dokumente
com/print/51828
BLOG Microcontrollers
Software Traps
0x00: NOP
0x00: NOP
0x200000: LJMP SWRST, SWRST is 0x0000
PS, actually it is not a 5 byte trap, it is a 3 byte trap, but the first trap code must be 5 byte,
because the consecutive trap is 0x00 0x00 0x20 0x00 0x00 0x20 0x00 0x00 ..., instead of 0x00
0x00 0x20 0x00 0x00 0x00 0x00 0x20 0x00 0x00.
0x00: NOP
0x200020: LJMP 0x0020
At the address of 0x0020, which stands for trap vector, we can put AJMP trap hander here. The
0x0020 of 80C51 is a spare code between T1 interrupt vector (0x001B) and SCON interrupt
vector (0x0023). It is enough to put both T1 handler and trap code here. Actually 4 bytes are
used. This approach is a little complex than the first one with additional code placed at 0x0020.
But the initial requirement for this approach is one byte less and in some critical application one
Extra Issues
The code might run out of order any time, especially in an interrupt service routine. The 80C51
has two registers, a software emulated reset can not clear the hardware interrupt flag in software
emulated reset. This is a solution :
Comments:
Trademarks