There are five interrupt sources for the 8051, which means that they can recognize 5 different events that can interrupt regular program execution. Each interrupt can be enabled or disabled by setting bits of the IE register. Likewise, the whole interrupt system can be disabled by clearing the EA bit of the same register.
3. This program code will read data from port 0 and write it to port 2, and it will stop looping when bit 3 of port 2 is set: