- Pages: 5
- Word count: 1191
- Category: Computers
A limited time offer! Get a custom sample essay written according to your requirements urgent 3h delivery guaranteedOrder Now
The microcontroller incorporates all the features that are found in microprocessor. The microcontroller has built in ROM, RAM, Input Output ports, Serial Port, timers, interrupts and clock circuit. A microcontroller is an entire computer manufactured on a single chip. Microcontrollers are usually dedicated devices embedded within an application. For example, microcontrollers are used as engine controllers in automobiles and as exposure and focus controllers in cameras. In order to serve these applications, they have a high concentration of on-chip facilities such as serial ports, parallel input output ports, timers, counters, interrupt control, analog-to-digital converters, random access memory, read only memory, etc.
The I/O, memory, and on-chip peripherals of a microcontroller are selected depending on the specifics of the target application. Since microcontrollers are powerful digital processors, the degree of control and programmability they provide significantly enhances the effectiveness of the application. The 8051 is the first microcontroller of the MCS-51 family introduced by Intel Corporation at the end of the 1970s. The 8051 family with its many enhanced members enjoys the largest market share, estimated to be about 40%, among the various microcontroller architectures.
The microcontroller has on chip peripheral devices. In this unit firstly we differentiate microcontroller from microprocessor then we will discuss about Hardware details of 8051 and then introduce the Assembly level language in brief. Microcontrollers
• Microcontroller (MC) may be called computer on chip since it has basic features of microprocessor with internal ROM, RAM, Parallel and serial ports within single chip. Or we can say microprocessor with memory and ports is called as microcontroller. This is widely used in washing machines, vcd player, microwave oven, robotics or in industries.
Microcontroller and Embedded Systems
• Microcontroller can be classified on the basis of their bits processed like 8bit MC, 16bit MC.
• 8 bit microcontroller, means it can read, write and process 8 bit data. Ex. 8051 microcontroller. Basically 8 bit specifies the size of data bus. 8 bit microcontroller means 8 bit data can travel on the data bus or we can read, write process 8 bit data.
PIN DIAGRAM OF 8051 MICRO CONTROLLER:
Description of each pin is discussed here:
• VCC 5V supply
• VSS: GND
• XTAL2/XTALI are for oscillator input
• Port 0 – 32 to 39 – AD0/AD7 and P0.0 to P0.7
• Port 1 – 1 to 8 – P1.0 to P1.7
• Port 2 – 21 to 28 – P2.0 to P2.7 and A 8 to A15
• Port 3 – 10 to 17 – P3.0 to P3.7
• P 3.0 – RXD – Serial data input – SBUF
• P 3.1 – TXD – Serial data output – SBUF
• P 3.2 – INT0 – External interrupt 0 – TCON 0.1
• P 3.3 – INT1 – External interrupt 1 – TCON 0.3
• P 3.4 – T0 – External timer 0 input – TMOD
• P 3.5 – T1 – External timer 1 input – TMOD
• P 3.6 –WR – External memory write cycle – Active LOW
• P 3.7 – RD – External memory read cycle – Active LOW
• RST – for Restarting 8051
• ALE – Address latch enable
1 – Address on AD 0 to AD 7
0 – Data on AD 0 to AD 7
• PSEN – Program store enable
Each block is explained as:
ALU — Arithmetic Logical Unit
This unit is used for the arithmetic calculations.
This register is used for arithmetic operations. This is also bit addressable and 8 bit register.
This register is used in only two instructions MUL AB and DIV AB. This is also bit addressable and 8 bit register.
• Points to the address of next instruction to be executed from ROM
8051 Flag Bits and PSW Register
1. Used to indicate the Arithmetic condition of ACC.
2. Flag register in 8051 is called as program status word (PSW).
This special function register PSW is also bit addressable and 8 bit wide means each bit can be set or reset independently.
There are four flags in 8051
• P → Parity flag → PSW 0.0
1 – odd number of 1 in ACC
0 – even number of 1 in ACC
• OV(PSW 0.2) → overflow flag → this is used to detect error in signed arithmetic operation. This is similar to carry flag but difference is only that carry flag is used for unsigned operation.
AC → Auxiliary carry flag → when carry is generated from D3 to D4, it is set to 1, it is used in BCD arithmetic.
CY → carry flag → Affected after 8 bit addition and subtraction. It is used to detect error in unsigned arithmetic opr. We can also use it as single bit storage.
SETB C; for cy = 1
CLR C; for cy = 0
Structure of RAM or 8051 Register Bank and Stack
1. 128 byte RAM is available in 8051
2. 128 byte = 27B
3. 128 byte visible or user accessible RAM is available which is shown in figure. Extra 128B RAM which is not user accessible. 80H to FFH used for storage of SFR (special function register)
Stack in 8051
→ RAM locations from 08H to 1FH can be used as stack. Stack is used to store the data temporarily.
Stack is last in first out (LIFO)
→ Stack pointer (SP) :
• 8bit register
• It indicate current RAM address available for stack or it points the top of stack.
• Initially by default at 07H because first location of stack is 08H.
• After each PUSH instruction the SP is incremented by one while in MC after PUSH instruction SP is decremented.
• After each POP instruction the SP is decremented.
Wall Follower using 8051 is built using TSOP based infrared sensor module. The Right module is used to detect the wall on the right of iBOT. Wall follower application can be built with only one module, but we are using the other sensor to avoid obstacle in front of the robot. The Right module is connected at approximately 45 degree to the board so as to detect the wall as shown in the image.
Here we are using 2 IR TSOP modules and iBOT will follow the wall on its right. The right TSOP module is for detecting the wall and the left module is used to avoid the iBOT from bumping into the front wall or obstacle.
Here if BOT detects wall on right it goes away from the wall, if it does not detect wall on right it goes right until the wall is detected.
The TSOP Sensor with Robosoft Systems is a miniaturized receiver for infrared remote control systems. PIN diode and preamplifier are assembled on lead frame, the epoxy package is designed as IR filter. The demodulated output signal can directly be decoded by a microprocessor. TSOP is the standard IR remote control receiver series, supporting all major transmission codes. Features:
1.Photo detector and preamplifier in one package
2.Internal filter for PCM frequency
3.Improved shielding against electrical field disturbance
4.TTL and CMOS compatibility
5.Output active low
6.Low power consumption
7.High immunity against ambient light
8.Continuous data transmission possible (up to 2400 bps)
1.Supply Voltage: –0.3…6.0 V.
2.Supply Current: 5 mA.
3.Output Voltage: –0.3…6.0 V.
4.Output Current: 5 mA.
5.Junction Temperature: 100 °C