MICROCONTROLLERS AND APPLICATIONS
Introduction Microcontroller
Microcontrollers are designed to perform specific task to control the single system unlike a microprocessor which perform multi function. A microcontroller became widely popular due to its System on Chip (SoC), processing memory and programmable input/output peripherals.
Microcontrollers are used in various embedded applications like Automobile control system, medical devices and toys because of small size and cost compared to a microprocessor.
In late 90’s 8051 microcontroller was introduced and widely used in various electronics field due to its feature available in it i.e. ( RAM – 128 bytes , ROM – 4k bytes , Timer – 2 , I/O pins – 32 , Serial port – 1, Interrupt sources – 6 ).
Criteria for choosing a microcontroller
First and foremost criteria in choosing a microcontroller is that it must have
1. Speed
2. Low power consumption
3. Cost per unit.
Microprocessor and Microcontrollers
The 8051 Architecture
ALU (Arithmetic & Logical unit)
This block is used to perform arithmetic or logical operation on 8 bit data.
A-Accumulator
This is 8 bit register. Arithmetic or logic operations are done on contents of accumulator. This register is also used as general purpose register.
B-Register
This is also 8 bit register. But this register is used just to perform multiplication or division, and not for other purpose.
PC(Program Counter)
Program counter is 16 bit register used to keep the track of program execution. Initially program pointer point to 0000H address location.
ROM Memory
In
8051 Microcontroller the ROM Memory is of 4k size using this capacity of memory
addressing from 0000H up to 0FFFH can be accessed. ROM memory is specifically
used to store the programs. Rom memory is volatile means data will not be erased
when supply is turned off.
PSW Register (Program Status Word)
PSW.7 | PSW.6 | PSW.5 | PSW.4 | PSW.3 | PSW.2 | PSW.1 | PSW.0 |
CY | AC | F0 | RS1 | RS0 | OV | -- | P |
FLAG Register
PSW.0
This bit of psw is to check priority.
If psw.0=1 indicates odd no. of 1’s in accumulator.
If psw.0=0 indicates even no. of 1’s in accumulator.
PSW.1
This bit is not used for any purpose.
PSW.2
This bit of psw is used to detect errors in signed arithmetic operation.
PSW.3 & PSW.4
These two bits (RS1 & RS0) of psw are used to select any one register bank from total 4 available in RAM memory of Microcontroller.
RS1 RS0 Register Bank Select
0 0 Bank 0
0 1 Bank 1
1 0 Bank 2
0 1 Bank 3
PSW.5
This bit of psw is user definable.
PSW.6
This bit of psw shows status of auxiliary carry flag when carry is generated from D3 to D4 bit while performing addition.
1 1 1
0 0 0 0 1 1 1 0 (0Eh)
+ 0 1 0 1 1 0 1 0 (5Ah)
------------------------------------
0 1 1 0 1 0 0 0 (38h)
PSW.7
This bit of psw shows status of carry flag after performing addition or subtraction as well as it is used to detect errors in unsigned arithmetic operations.
RAM
Structure of 8051 Microcontroller
In
8051 Microcontroller 128 bytes of RAM memory is available for user access.
Address range of RAM memory is from 00H to 7FH. Remaining 128 bytes of RAM
memory which is not accessible to user is from 80H to FFH is used for storage
of SFR (Special Function Register).