Keil Logo


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 code.
  • 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 vection.
  • 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 address 0000h.

To modify the startup code:

  1. Copy the startup code (STARTUP.A51) from the \c51\lib directory to your project directory.
  2. Edit your project's copy of STARTUP.A51.
  3. Search for CSEG AT 0
  4. Insert the NOP just after the CSEG AT 0 and before the LJMP. (Or change the LJMP to an AJMP if necessary.).



The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Saturday, July 9, 2005

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.