This post provides the external interrupt (INT0) code ( using c language ) for 8051 microcontroller ( e-g for AT89C51 or AT89C52 etc ). In this code neg-edge triggered interrupts are enabled on INT0 pin as an example of demonstrating usage of INT0 pin. You can use this code for many purposes, for example when you need to control servo motor which has position encoder, with your 8051 microcontroller, then external interrupt handling is required.