Thursday, January 31, 2019

8051 Micro Controller Notes


***Explain OVER VIEW of 8051 Microcontroller (OR) Explain basic functional blocks of a Microcontroller
·               The Microcontroller is a Programmable IC by VLSI Technique and capable of performing Arithmetic and Logical operations.
·               The  basic functional blocks of a microcontroller are ALU, Flag register, Register array, Program Counter (PC), Instruction decoder, Timing and control Unit, RAM memory, EPROM/EEPROM memory, Parallel I/O port, Serial I/O port, programmable timer, ADC & DAC. But all the microcontrollers may not have all the blocks.
·               In  microcontroller ALU performs arithmetic and logical operations.
·               Flag Register:  The various conditions of the result are stored as status bits in flag register.
·               Register array & Internal RAM memory are used as temporary storage device for storing temporary data during execution of a program.
·               EPROM/EEPROM: The program codes and permanent data are stored in EPROM/EEPROM.
·               In microcontroller based systems external memory is provided when internal memory is not sufficient.
·               Program Counter : The program counter generates the address of the instructions to be fetched from the memory and send to the memory.
o      The micro controllers communicate with external world only through I/O Ports.
o      The instruction codes are decoded by instruction decoding Unit and send information to timing and Control Unit.
o      The timing & Control Unit will generate the necessary control signals for internal and external operation of the microcontroller.
o      The parallel and Serial I/O Ports are used for interfacing I/O devices like Switches, Keyboard, LCD/LED, ADC, DAC ect. and also for any other input/output operations.
o      The microcontrollers does not have dedicated external address and data bus. Therefore for interfacing any additional Peripheral  devices, the external address and data buses are using port lines.
o      The microcontrollers with internal ADC can directly accept analog signals for processing.
o      The microcontroller with internal DAC can directly generate analog signals  for controlling analog devices.
§    The programmable timer can be used for time based operations and it can also be used as a counter.
*** Explain the features of 8051 Microcontroller.
Features of 8051:
·         4096 bytes On-Chip program memory.
·         128 bytes On-Chip data memory .
·         Four register banks.
·         128 User-defined Software flags.
·         64 K bytes each program and external RAM addressability.
·         One microsecond instruction cycle with 12MHz crystal.
·         32 Bi directional I/O lines organized as four 8-bit Ports.
·         Multiple mode, High-speed programmable Serial port.
·         Two multiple mode, 16-bit Timers/Counters.
·         Two-level prioritized interrupt Structure.
·         Full depth Stack for subroutine return linkage and data storage
·         Direct byte and bit address ability
·         Binary  or decimal arithmetic
·         Signed-overflow detection and parity computation
·         Hardware multiple and divide in 4 µsec

*** Explain the Architecture of 8031/8051 (OR) Function of  block (OR) Register organization (OR) Block diagram.

The various functional blocks of 8051 are ALU, Special function Registers (SFR) , Instruction Register (IR), Program Counter (PC),  128 bytes RAM, 4 Kb ROM, Port latches and drivers, oscillator, Timing & Control  Unit.
The 8031/8051 has Harvard Architecture it has same address in different memory device or banks for using program and data
It has two16- bit pointers one is program counter  (pc) it is used as address pointer
To access program instructions and it is automatically incremented after every byte of instruction  fetch.
Second  one is data pointer ( DPTR) it is used as address pointer to read /write data in data memory  and it  is programmable using instructions .
By using this 16- bit  pointers we can address  216 =64 Kb. Memory locations. Hence 8051/8031 supports two memory banks of 64 Kb each, one for program and the other for data.
EA (External access) Used to read program from external memory.
When EA bar is connected  to ground (logic-0) then entire 64Kb is used as external  (EPROM/RAM) memory.
If we want to read from external memory then EA bar is connected to GND that means EA=5V or 1.
If we use only internal memory  then we connect EA bar to Vcc (5V) Means EA=0V.
When EA bar is connected to Vcc (logic-1) the first 4 Kb of program memory is refer to internal ROM (4Kb) & remaining 60Kb is to external (EPROM/RAM). Memory.
8051 has separate 256 bytes internal RAM( by 8-bit address). In 256 bytes, first 128 bytes are allotted for internal RAM and next 128 bytes are to SFR.

It has four 8-bit Ports as Port-0,Port-1, Port-2, Port-3. Each port has a latch and driver (or Buffer).
The alternate function of Port-0 lines as multiplexed low byte address/data lines.
The alternate function of Port-2 lines  as high byte address lines.
The alternate function of Port-3 as control signals. Port-1 does not have any alternate function.

There are 21 internal registers in SFRs. The SFRs are mapped as internal data memory. The data memory address space 80H to FFH.

The 8051 has 8-bit ALU: to perform Arithmetic and logical operations on binary data. The A & B registers are used to hold the input data and the result of ALU operation.

The PSW store the Status of the result of ALU operations. It contains 4 Math flags & 2 register bank select bits.
The Controller will fetch the instructions one by one and starting  address is stored in PC & Stored in IR. Which decodes the instructions and give information to Timing & Control Unit.
An external quartz Crystal is connected for clock generation.
By using 16-bit programmable timer/counter they can  count the number of high to low transitions of the signal applied to the timer pins.
 8051 family of microcontrollers has a full duplex Serial port , can be programmed to work in any one of four operating modes  as Mode-0, Mode-1, Mode-2, Mode-3

There are 128 bytes of RAM inside the 8051 µc with 00H to 7FH address. These 128 bytes are divided  into three different groups as
1.     32 bytes from 00H to 1FH locations are set for register banks and stack.
2.    16 bytes from 20H to 2FH are set for bit-addressable RAM.
3.    80 bytes from 30H to 7FH are used for  read and write storage or scratch pad.

The PCON register is used for power control and baud rate selection. It also consists general purpose user flags.

TMOD register is used to select the operating mode and the timer/ counter .

TCON register consists of timer over-flow flags, timer run control bits, external interrupt flags and external  interrupt  type control bits.
Including RESET there are 6 interrupts in 8051 µC.
IE register is used to enable or Disable the interrupts of 8051.

IP register can be programmed to make the priority of interrupt .
SBUF register is to hold the data. SCON controls data communication register, PCON controls data rates .    
***Write a short note on Register Banks and Stack

There are 128 bytes of RAM inside the 8051 Microcontroller from  00H to 7FH. These 128 bytes are divided into Three different groups as
1.    32 bytes from 00H to 1FH are set for register banks and Stack.
2.    16 bytes from 20H to 2FH are set for bit-addressable RAM.
3.    80 bytes from 30H to 7FH are used for  read and write storage or scratch pad.


These 80 locations of RAM are widely used for the purpose of storing data and parameters by 8051 programmers.
A total 32 bytes of RAM are set for the register banks and Stack. These 32 bytes are divided into 4 banks of registers.

Each bank has 8- registers RO to R7  RAM locations from 00H to 07H are set as Bank0, 08H to 0FH are set as Bank1, 10H to 17H are at as Bank2 & 18H to 1FH are set as Bank3.
Bank 1 uses the same RAM space as the stack . This is a major problem in programming the 8051.
We can Select the banks by using PSW bits D3 & D4 (RS0 &RS1 ). The particular register bank is selected by the bit addressable instructions SET B & CLR.
Eg: SET B  PSW.3  
*** Explain Memory Organization of 8031/8051.

A Micro controller based system require both EPROM and RAM. The EPROM is required for permanent program and permanent Data storage.
 The RAM is required for temporary Data storage and Stack. The 8031/8051 has 64K bytes program memory & 64 K bytes Data memory.
The Microcontroller can only read from program memory. PSEN bar Signal is used for reading the program memory. ROM  / EPROM / EEPROM are used as program memory.
The microcontroller can read and write with data memory . RD bar & WR bar signals are used for reading and writing the Data memory. Static RAM can be used as Data memory.
In 8051 micro controller the entire 64 Kb data memory space is external . It’s address is 0000H to FFFFH.
A part from external data memory, the 8051 has 256 bytes of internal data memory in which the first 128 bytes are called Internal RAM & next 128 bytes are called SFR. The address range of SFR’s & internal RAM are 00H to FFH.
The 8051 has 4 Kb internal ROM can be mapped to first 4Kb address space of program memory if EA pin is High.
 The address of internal ROM is 0000H to 0FFFH. The usage of internal ROM is optional. The external program memory 60Kb address range is 1000H to FFFFH. Remaining program memory.
When EAbar pin is low the entire 64 Kb program memory 0000H to FFFFH is treated as external memory. i.e internal 4Kb ROM cannot be accessed.
By using this 16- bit  pointers we can address  216 =64 Kb. Memory locations. Hence 8051/8031 supports two memory banks of 64 Kb each, one for program and the other for data.

EA (External access) Used to read program from external memory.
When EA bar is connected  to ground (logic-0) then entire 64Kb is used as external  (EPROM/RAM) memory.
If we want to read from external memory then EA bar is connected to GND that means EA=5V or 1.
If we use only internal memory  then we connect EA bar to Vcc (5V) Means EA=0V.
When EA bar is connected to Vcc (logic-1) the first 4 Kb of program memory is refer to internal ROM (4Kb) & remaining 60Kb is to external (EPROM/RAM). Memory.
  In 8031/8051 based system, It is possible to have a single memory bank for both program and data.
To minimize the cost & when memory requirement is less then single memory is used for both data & Program.
When a single memory bank is provided then the read control signal is generated by logically ANDing the PSEN and RD signals.
When a single bank is provided then system designer has to partition the total 64 Kb of address space for program and data. Then the 256 bytes internal memory can be accesses as data memory by using 8-bit address.
 The 8051 microcontroller does not provide separate I/O addresses. Therefore in 8051 based system only memory mapped I/O is possible. Hence some of the memory address space should be reserved for I/O devices.
*** Explain 8051 Port Organization 

Port Organization: The port is a buffered IC which is used to hold the data transmitted from the microcontroller to I/O device (OR) vice versa.
In 8051 Microcontroller there are 4 ports P0, P1, P2 and P3. Each port is a 8-bit bidirectional port. Each pin in a each port has a D-type output latch.
There are 3 components in the structure. They are (1). D-latch (2). Output driver (3). Input buffer   
Port-0 pins are used for inputs and outputs. When 8051 is connecting to an external memory then port-0 used for both address and data bus. i.e AD0 – AD7 .
When ALE=0 then port-0 works as data bus. (D0-D7 ). When ALE=1, then port-0 works as lower order Address bus A0-A7 . Therefore ALE is used for demultiplexing address and data with the help of a Latch (74LS373).
 When 8051 is not connected to external memory then port-0 pins must be connected externally to 10K-ohm pull-up resister.
This is due to that P0  is an open drain with external pull-up resistors port-0 can be used as simple I/O port. Like P1, P2 , P3 ports.
P1, P2 , P3 ports  do not need any pull-up resistors because they already have pull-up resistors internally.
Port-1 and Port-2 are used as simple I/O. When external memory is connecting Port-2 must be used as higher order address bus A8 –A15 .
Port- 2 along with port-0 provide 16-bit address bus. By using this 16-bit address lines 8051 can access 64-Kbytes of external memory.
Port-3 can be used as input or output port-3 also does not need any pull-up resistors as port-1 and port-2.
When 8051 is connecting to an external memory then port-3 provides some control signals as P3.0  and P3.1  are used for RXD & TXD Serial communication signals. P3.2  &P3.3  are INT0 & INT1 for external interrupts.  P3.4  & P3.5  are T0 &  T1 used for Timer 0 and Timer1. P3.6  and P3.7  are used to provide WR bar & RD bar signals of external memory connections.

Tuesday, January 29, 2019

MOSFET NOTES


Metal Oxide Semiconductor FET
Introduction.
Symbol:

·         The Metal Oxide Semiconductor Field Effect Transistor (MOSFET) is one type of  FET transistor.
·          In MOSFET the gate terminal is electrically insulated from the current carrying channel so it is called as IG-FET.
·         Due to the insulation between gate and source terminals the input resistance of MOSFET may be in mega ohms (MΩ).
·          MOSFET also acts as a voltage controlled resistor when no current flows into the gate terminal.
·          The small voltage at the gate terminal controls the current flow through the channel between the source and drain terminals. 
·           MOSFET  terminals are, Drain (D), Source (S), Gate (G) and substrate.
·         The MOSFETs are  available in both types, N-channel (NMOS) and P-channel (PMOS).
·         The MOSFETs are basically classified in to two forms they are Depletion type and Enhancement type transistors.

Working Principle of MOSFET:

·         The aim of the MOSFET is to control the voltage and current flow between the source and drain. It works almost as a switch.
·         The working of MOSFET depends upon the MOS capacitor. The MOS capacitor is the main part of MOSFET.
·         The semiconductor surface at the below oxide layer  is located between source and drain terminal.
·         It can be  inverted from p-type to n-type by applying a positive or negative gate voltages .  
·         When we apply the positive gate voltage the holes present under the oxide layer with a repulsive force and holes are pushed downward with the substrate.
·         if a voltage is applied between the drain and source, the current flows freely between the source and drain and the gate voltage controls the electrons in the channel.
·         Instead of positive voltage if we apply negative voltage , a hole channel will be formed under the oxide layer.
In general, any MOSFET is  operated in three regions :
1.    Cut-Off Region
In this region MOSFET will be in OFF state. No 
current flow through it.  It behaves as open switch and is used as electronic switches.
2.    Ohmic or Linear Region
In this region the current IDS increases with increasing of VDS. This region, is used as amplifiers.
3.    Saturation Region
In this region,  IDS  is constant by increase in VDS and once VDS exceeds the value of pinch-off 
voltage VP. the device will act as closed switch.

Construction of an EMOSFET:

1.    The main difference between the construction of DE-MOSFET and  E-MOSFET, is that E-MOSFET substrate extends all the way to the silicon dioxide (SiO2) and no channels are doped between the source and the drain.
2.    Channels are electrically induced in these MOSFETs, when a positive gate-source voltage VGS is applied to it.
Operation of an EMOSFET:

1.    This MOSFET operates only in the enhancement mode and has no depletion    mode.
2.     It  operates with large positive gate voltage only. It does not conduct  
  when the gate-source voltage VGS = 0,  is called MOSFET –off.
3.    Drain current ID flows only when VGS exceeds VGST [gate-to-source threshold voltage].
4.    When drain is positive w.r.to source and no potential is applied to the gate.
5.    Then two P-N junctions connected back to back with a resistance of the P-substrate.
6.    A  very small drain current i.e, reverse leakage current flows.
7.    If P-type substrate is connected to the source terminal, then zero voltage lies across the source substrate junction, and thedrain-substrate junction remains reverse biased.
8.    When the gate is made positive w.r.to the source and the substrate, negative (i.e. minority) charge carriers within the substrate are attracted to the positive gate and accumulate close to the-surface of the substrate.
9.     As the gate voltage is increased, more and more electrons accumulate under   the gate.
10. These electrons flow across the insulated layer to the gate, so they accumulate at the surface of the substrate just below the gate.
11. These accumulated minority charge carriers N -type channel stretching from drain to source.
12. Then an inversion layer (N-type) is induced in channel. Now a drain current start flowing.
13. The strength of the drain current depends upon the channel resistance and number of charge carriers attracted to the positive gate. Thus drain current is controlled by the gate potential.
14. The conductivity of the channel is enhanced by the positive bias on the gate so this device is called the enhancement MOSFET or E- MOSFET.
15. E-MOSFET is classified as an enhancement-mode device because its conductivity depends on the action of the inversion layer.
16. Depletion-mode devices are normally ON when VGS = 0, whereas the enhancement-mode devices are normally OFF when VGS = 0.
Characteristics of an EMOSFET.
Drain Characteristics-EMOSFET

1.     When VGS  < VGST  then ID =0. When VGS is greater than VGST, then device turns- on and  ID is controlled by the gate voltage.
2.     The characteristic curves have almost vertical and almost horizontal parts.
3.     Thus E-MOSFET can be used as a variable-voltage resistor (WR) or as a constant current source.
EMOSFET-Transfer Characteristics

1.    The current IDSS at VGS <=0 is very small, of a few nano-amperes.  
2.    When VGS is positive, then Iincreases slowly at first, and then much more rapidly with an increase in VGS.
The equation for the transfer characteristic of E-MOSFETs is given as:
ID=K(VGS-VGST)2


·         For zero value of VGS, the E-MOSFET is OFF because there is no conducting channel between source and drain.
·         The symbols has broken channel line to indicate the normally OFF condition.
·          VGS exceeding the threshold voltage VGST, an N-type inversion layer, connecting the source to drain, is created.

Depletion Mode MOSFET

·         The depletion mode MOSFETs are generally known as ‘Switched ON’ devices,
·         These  are generally closed when there is no bias voltage at the gate terminal.
·          If the gate voltage increases in positive, then the channel width increases in depletion mode.
·         The drain current Ithrough the channel increases.
·         If the applied gate voltage more negative, then the channel width is very less and MOSFET may enter into the cutoff region.
·         The depletion mode MOSFET is rarely used type of transistor in the electronic circuits.
·         V-I characteristic mainly gives the relationship between drain- source voltage (VDS) and drain current (ID).
·         The small voltage at the gate controls the current flow through the channel.
·         The channel between drain and source acts as a good conductor with zero bias voltage at gate terminal.
·         The channel width and drain current increases if the gate voltage is positive and these two (channel width and drain current) decreases if the gate voltage is negative
.