Day 2: Working Principle of MicroController

strict warning: Only variables should be passed by reference in /var/www/vhosts/ on line 559.


Introduction to 8051 MICROCONTROLLER


     Basic Circuit for 8051: The 8051 is one of the most popular microcontrollers in use today. Many derivative microcontrollers have since been developed that are based on and compatible with the 8051. Thus, the ability to program an 8051 is an important skill for anyone who plans to develop products that will take advantage of microcontrollers. The various chapters of the Tutorial will explain How to Interface different circuits to 8051 like I/O Ports LED, Switch, Relay, ULN, RS232C Cell Phones, GPS receiver, 7-Seg. Display, LCD Display, ADC & DAC, Sensors, Stepper Motor, DTMF Decoder, Keyboard, External Memory with relevant theory, schematics and sample codes in Assembly language & C language (SPJ). The chapters are targeted at people who are attempting to learn 8051 hardware and assembly language programming.


  • 8051 PIN OUT
  • Power - Vcc, Vss
  • Reset - RST
  • Crystal - XTAL[1,2]
  • External device interfacing – EA, ALE, PSEN, WR, RD
  • I/O Port – P0[7;0], P1[7:0], P2[7:0], P3
  • P3 is shared with control lines
  • Serial I/O RxD, TxD,
  • external interrupts INT0, INT1
  • Counter control T0, T1
  • P0 and P2 are multiplexed with Address and Data bus
  • Basic Pins

PIN 9: PIN 9 is the reset pin which is used reset the microcontroller’s internal registers and ports upon starting up.2 machine cycle should be high at this pin.

PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only connect a crystal at these pins to provide clock pulses to the circuit.

PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip needs +5V 500mA to function properly, although there are lower powered versions like the Atmel 2051 which is a scaled down version of the 8051 which runs on +3V.

PINS 29, 30 & 31: As described in the features of the 8051, this chip contains a built-in flash memory. In order to program this we need to supply a voltage of +12V at pin 31. If external memory is connected then PIN 31, also called EA/VPP, should be connected to ground to indicate the presence of external memory. PIN 30 is called ALE (address latch enable), which is used when multiple memory chips are connected to the controller and only one of them needs to be selected. We will deal with this in depth in the later chapters. PIN 29 is called PSEN. This is "program select enable". In order to use the external memory it is required to provide the low voltage (0) on both PSEN and EA pins.


The EA on pin 31 is tied high to make the 8051 executes program from Internal ROM.


Reset Circuit:

  • RESET is an active High input When RESET is set to High, 8051 goes back to the power on state.
  • The 8051 is reset by holding the RST high for at least two machine cycles and then returning it low.

Power-On Reset

  • Initially charging of capacitor makes RST High
  • When capacitor charges fully it blocks DC.

Manual reset

  • closing the switch momentarily will make RST High.
  • After a reset, the program counter is loaded with 0000H but the content of on-chip RAM is not affected.


  • If the on-chip amplifier is a simple inverter, such as in the 8051, the user can select values for CX1 and CX2 between some 20 and 100 pF, depending on whether start-up time or frequency stability is the more critical parameter in a specific application.

  • These capacitors are used to ensure oscillation. The value is NOT critical. Any value from 15pF to 40pF can do (22pF to 30pF recommended). Sometime it works even without capacitors - the stray capacitance is large enough to start oscillation.


The time periode of the machine cycle for the crystal frequency of 11.0592MHz is,

11.0592MHz / 12 = 921.6KHz;Machine cycle is 1 / 921.6KHz =1.085 us.

From the Web

Suggestions: (1)

See few results | more results

Search: [Press Enter]

Share |