27 October, 2015


The program shows how to display prime numbers. Here two for loops are used. A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself. A natural number greater than 1 that is not a prime number is called a composite number. For example, 5 is prime, as only 1 and 5 divide it, whereas 6 is composite, since it has the divisors 2 and 3 in addition to 1 and 6Read More

5 April, 2012

Bit Addresses for I/O and RAM

Many microprocessors such as X86 and Pentium allow programs to access registers and I/O ports in byte size only. In other words, if you need to check a single bit an I/O port, you must read the entire byte first and then manipulate the whole byte with some logic instructions to get hold of the desired single bit. This is not the case with the 8051. Read More

11 April, 2012

Loop And Jump Instructions

LOOP: Repeating a sequence of instructions a certain number of times is called a loop. Loop action is performed by DJNZ reg, Label The register is decremented If it is not zero, it jumps to the target address referred to by the label Prior to the start of loop the register is loaded with the counter for the number of repetitions Counter can be R0 – R7 or RAM locationRead More

5 April, 2012

Addressing Modes in 8051

The CPU can access the data in various ways. The data could be in a register, or in memory or be provided as an immediate value. These various ways of accessing data are called addressing modes. The various addressing modes of a microprocessor are determined when it is designed, and therefore cannot be changed by the programmer.Read More

10 April, 2012

Pins Description Of The 8051 Microcontroller

Pins On The 8051 Microcontroller: 1–8 (Port 1): Each of these pins can be used as either input or output according to functionality. Also, pins 1 and 2 (P1.0 and P1.1) have special functions associated with Timer 2. 9-Reset Signal: high logical state on this input halts the MCU and clears all the registers. Bringing this pin back to Read More

1 March, 2012

RAM memory space allocation in the 8051

There are 128 bytes of RAM in the 8051. The 128 bytes of RAM inside the 8051 are assigned addresses 00 to 7FH. They can be accessed directly as memory locations. These 128 bytes are divided into three different groups.A total of 32 bytes from locations 00 to 1FH are set aside for register banks and the stack.Read More

2 February, 2012

Program counter in 8051

Another important register in the 8051 is the PC (program counter). The program counter points to the address of the next instruction to be executed. As the CPU fetches the opcode from the program ROM, the program counter is incremented to point to the next instruction. The program counter in the 8051 is 16-bits wide. Read More

2 February, 2012

Register banks in 8051

A total of 32 bytes of RAM are set aside for the register banks and stack. These 32 bytes are divided into 4 banks of registers in which each bank has 8 registers, R0-R7 where R0 is RAM location 0; R1 is RAM location 1, and so on, until memory location 7, which belongs to R7 of bank 0.The second bank of registers R0-R7 starts at RAM location 08 and goes to location 0FH. Read More