EXECUTING SPECIAL INSTRUCTIONS IMMEDIATELY AFTER RESET
Applies to: C51 C Compiler
Information in this article applies to:
- C51 Version 5.50a
- C51 Version 6.01
I need to add a NOP instruction as the first instruction executed
after a reset. How do I do that?
To insert a NOP after reset, you'll have to modify the startup
code. There are a few things to note:
- After reset, program execution begins at 0000h.
Typically, the instruction at 0000h is an LJMP to your startup
To insert a NOP as the first instruction that gets executed,
you'll have to modify the startup code so that at address 0000h,
you have NOP, LJMP.
- The code at address 0003h is the first interrupt vector.
Adding a NOP, LJMP at address zero will put the last byte of
the LJMP at address 0003h, which covers up the interrupt 0
- If you don't use this interrupt, this isn't a problem.
If you DO use this interrupt, you may want to try NOP, AJMP at
To modify the startup code:
Copy the startup code (STARTUP.A51) from the c51lib directory
to your project directory.
- Edit your project's copy of STARTUP.A51.
- Search for CSEG AT 0
Insert the NOP just after the CSEG AT 0 and before the LJMP.
(Or change the LJMP to an AJMP if necessary.).
Article last edited on: 2005-07-09 11:03:45
Rate this article
Disagree? Move your mouse over the bar and click