Quote of the day “Learn from yesterday, live for today, hope for tomorrow. The important thing is to not stop questioning.” ― Albert Einstein, Relativity: The Special and the General Theory Microprocessors and Microcontrollers • Microprocessor: general-purpose CPU – Emphasis is on flexibility and performance – Generic user-interface such as keyboard, mouse, Memory etc. – Used in a PC, PDA, cell phone, etc. • Microcontroller: general-purpose CPU + memory + timer circuit on a single chip(application oriented manufacturing) – Emphasis is on size and cost reduction. – The user interface is tailored to the application, such as the buttons on a TV remote control. – Used in a digital watch, TV remote control, car and many common day-to-day appliances. • Microcontroller architecture refers to the internal hardware organization of a microcontroller. • It determines how and when various operations are performed by the microcontroller. • Each hardware architecture has its own set of software instructions called assembly language that allows programming of the microcontroller. • Harvard Architecture—a type of computer architecture where the instructions (program code) and data are stored in separate memory spaces – Example: Intel 8051 architecture • Von Neumann Architecture—another type of computer architecture where the instructions and data are stored in the same memory space – Example: Intel x86 architecture (Intel Pentium, AMD Athlon, etc.) • Some of the popular microcontroller architectures – Intel 8051 – Zilog Z80 – Atmel AVR • The Intel 8051 is a very popular general purpose microcontroller widely used for small scale embedded systems. • Many vendors such as Atmel, Philips, and Texas Instruments produce MCS-51 family microcontroller chips. • In recent years some companies have incorporated many different and additional features into 8051. • The 8051 is an 8-bit microcontroller with 8 bit data bus and 16-bit address bus. • Address bus is a group of 16 lines used to carry address of memory(where data is stored) / address of the device(communicating with microcontroller device). • Data bus is a group of 8 lines used to carry 8-bit data from one section to another section internally or from microcontroller to the other device interfaced to it. • The 16 bit address bus can address a 64K( 216) byte code memory space and a separate 64K byte of data memory space. • The 8051 has 4K on-chip read only code memory and 128 bytes of internal Random Access Memory (RAM) • A group of filp-flops is referred as register in digital circuits, which holds the data temporarily. • A group of lines on which information is transferred from one place to other is termed as bus. External interrupts Interrupt Control On-chip ROM for program code Timer/Counter On-chip RAM (SFR) Timer 1 Timer 0 CPU OSC Bus Control 4 I/O Ports P0 P1 P2 P3 Address/Data Serial Port TxD RxD Counter Inputs • The crystal frequency is the basic internal clock frequency. • Clock is the smallest interval of time required to accomplish any simple instruction. • Serial communication always needs dictate the clock frequency because of internal requirement to yield standard baud(Bit per second) rate. OSC Crystal or Ceramic Resonator Central processing unit (CPU) • Arithmetic logic unit (ALU) which performs arithmetic and logic functions. • Registers A and B. • Program Counter (PC) and DPTR (Data pointer. • Program status word. • 4-8-bit register bank available from RAM. Arithmetic and Logic Unit A B PC DPTR DPH DPL Address Bus PSW 8 BIT DATA / ADDRESS BUS RAM/ ROM • The 8051 has various 34 8-bit general purpose, Registers. Of these the two Accumulator (A) and B registers. • Registers A and B are used in holding results of mathematical and logical operations performed by CPU. • The accumulator register is the most useful register apart from arithmetic and logical operations it is also used in many data transfer and bit manipulation operations. • The B register is used along with A for multiplication and division operations. • The other 32 are arranged as part of internal RAM in Four Banks, B0-B3 of 8-registers each. • The ALU performs one 8-bit operation at a time. • The arithmetic operations such as addition/ subtraction/multiplication/division and logical AND, OR, NOT and XOR are performed by ALU. • The CPU has many important registers. The Program Counter (PC) is one of this, always holds the code memory location of next instruction to be executed. • It is the only register that does not have address. • MCU fetches instructions from the code memory pointed by PC analyzes the opcode of the instruction. • And updates the PC to the location of next instruction, fetches the operand from the data memory if necessary, and finally performs the operation instructed by the instruction. • Fetch operation—retrieves an instruction from the location in code memory pointed to by the program counter (PC) • Execute operation— executes the instruction that was fetched during the fetch operation. In addition to executing the instruction, the CPU also adds the appropriate number to the PC to point it to the next instruction to be fetched. Program Counter (PC) Code Memory F e t c h + CPU To other peripherals • The DPTR is made of two 8-bit registers, DPH and DPL, are used to furnish memory addresses for internal and external code (Program) access and external data access. • The DPTR is used by programmer through instructions. • DPH and DPL are assigned separate address, DPTR does not have a single internal address. • Program status word—PSW(8 bit-Flag register) – Shows the status of arithmetic and logical operations using multiple bits – They indicate some conditions that result after an execution of instruction. bit 7 CY • • • • • bit 6 AC bit 5 F0 bit 4 RS1 bit 3 RS0 bit 2 OV bit 1 -- bit 0 P P: parity check flag Bit1: Reserved for future use. OV: ALU overflow flag RS0/RS1: Register bank specification mode 00: bank 0 (00H-07H); 01: bank1(08H-0FH); 10: bank 2(10H17H); 11: bank 3(18H-1FH) • F0: User defined flag • CY: ALU carry out • AC: ALU auxiliary carry out(Carry from bit 3 to bit 4 of ALU) • Carry Flag(CY):- This flag is set whenever a carry out from D7 bit is generated. This bit is affected after addition and subtraction operations. • Auxiliary carry (AC):- If there is a carry from D3 to D4 bit during an addition or subtraction operation then this bit is set to one. • Parity flag(P):- Parity flag represents the number one’s in accumulator register. It is set to 1 for odd number of one’s in A. • Overflow flag(OV):- Set to one to represent erroneous result after arithmetic operations • Register bank specification (RS0 and RS1):D3 and D4 together used to change the register bank to be used out of four. There are four register banks and each bank consists of 8-registers R0 to R7. • Selection mode RS1 RS0 Register Bank Address 0 0 Bank 0 selected 00H-07H 0 1 Bank 1 selected 08H-0FH 1 0 Bank 2 selected 10H-17H 1 1 Bank 3 selected 18H-1FH
© Copyright 2026 Paperzz