Thursday, 30 May 2013

Embedded System - 01

Keyword: Embedded System, Microcontroller

Embedded System Tutorial - 01


Introduction to Embedded System
In the daily life we use lots of electronics devices like Calculators, Computers, Automatic Washing Machines and Mobile Phones etc. The common thing in all these devices is that they all contain Microprocessor (Brain in the Electronic Systems). So they all are Microprocessor Based System. Actually Microprocessor based systems are divided into two categories:

Reprogrammable Systems
These are the general-purpose systems. We can run programs of different type of language programs like C, C++, Java, Visual Basic etc. Even we can listen the music, watching the movies, surfing Internet, sending mails etc. That is, these systems can be reprogrammed from the user's end and they are general-purpose type. Examples of these systems are Personal Computer, Laptop, and Workstations etc.
Embedded Systems
These are not general-purpose systems but these systems are specially designed for specific applications. The examples of Embedded Systems are Robots, Calculators, Digital Weighing Machine, Xerox Machine, Metro Rails without Drives etc. In such a ways we can say that, Embedded Systems are the microprocessor or microcontroller based electronics systems which are designed for the specific task only.
What is a Microcontroller?
A Micro controller consists of a powerful CPU tightly coupled with memory RAM, ROM (or EPROM), various I/O features such as Serial ports, Parallel Ports, Timer/Counters, Interrupt Controller, Data Acquisition interfaces-Analog to Digital Converter (ADC), Digital to Analog Converter (ADC), everything integrated onto a single Silicon Chip.
It does not mean that any microcontroller should have all the above said features on chip, Depending on the need and area of application for which it is designed, The ON-CHIP features present in it may or may not include all the individual section said above.
Any microcomputer system requires memory to store a sequence of instructions making up a program, parallel port or serial port for communicating with an external system, timer/counter for control purposes like generating time delays, Baud rate for the serial port, apart from the controlling unit called the Central Processing Unit.
Difference between Microprocessor and Microcontroller
Microprocessor:
  • CPU is stand-alone, RAM, ROM, I/O, timer are separate
  • Designer can decide on the amount of ROM, RAM and I/O ports.
  • Expansive
  • Versatility
  • General-purpose
Microcontroller:
  • CPU, RAM, ROM, I/O and timer are all on a single chip 
  •  fix amount of on-chip ROM, RAM, I/O ports
  • for applications in which cost, power and space are critical
  • single-purpose
Conclusion:
Both microprocessors and microcontrollers have to run commands and therefore run a device on its own, however it’s the minute architectural design of the microcontroller that leaves a person interested in awe of the tasks it can perform when it is compared to a microprocessor. When a person requires running a word document or a video game on their computers they are essentially using the microprocessor, and when they have to work a microwave oven, they are working a microcontroller. Therefore, microcontrollers are more specific to the appliance they are configured for.

Features of 8051 Microcontroller’s:
  • 8-Bit CPU Optimized for Control Applications
  • Extensive Boolean Processing Capabilities (Single-Bit Logic)
  • On-Chip Flash Program Memory of 4kB (89X 51 families)
  • On-Chip Data RAM 128 Byte
  • Bi-directional and Individually Addressable, I/O Lines
  • Multiple 16-Bit Timer/Counters
  • Full Duplex UART for serial communication
  • Multiple Source/Vector/Priority Interrupt Structure
  • On-Chip Clock Oscillator
  • On-chip EEPROM (AT89S series)
  • SPI Serial Bus Interface (AT89S Series)     
  • Watchdog Timer (AT89S Series)
8051 Architecture and Pin diagram:
8051 Pin Description:

  • P0-Port 0 ( Pin 32-39)
  • P1-Port 1 (pin 1-8) 
  • P2-Port 2 (Pin 21-28)
  • P3-Port3(Pin10-17)      
  • AD0 - AD7 -          Multiplexed Address/data lines
  • A8-A15 -                High Order Address Lines
  • RST -                     Reset (pin 9)
  •  T0, T1  -                Timer Clock Input
  • INT0, INT1 -        External Interrupt Lines
  • XTAL1, XTAL2 - Crystal Oscillator Pins (Pin 18-19)
  • WR,  RD  -            Write, Read Lines
  • RxD, TxD  -           Serial Receive / Transmit Lines
  • ALE/PROG -        Address Latch Enable / Program   Logic In burning the Flash ROM)
  • EA/VPP -               External Enable / VCC (burning the Flash ROM) VCC / GND = +5 volt
  • PSEN -                   Program Store Enable (Pin 29)
  •  GND                    Ground (Pin 20).
  • VCC-                     +5V Power Supply.
Port 0 (Pin 32-39):
Port 0 is an 8-bit open drain bidirectional I/O port. If external memory is not used, these pins can be used as general inputs/outputs. Otherwise, P0 is configured as address output (A0-A7) when the ALE pin is driven high (1) or as data output (Data Bus) when the ALE pin is driven low (0).

Port 1 (pin 1-8):
Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. Port 1 also receives the low-order address bytes during Flash programming and verification.

Port 2 (Pin 21-28):
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups.  If there is no intention to use external memory then these port pins are configured as general inputs/outputs. In case external memory is used, the higher address byte, i.e. addresses A8-A15 will appear on this port. Even though memory with capacity of 64Kb is not used, which means that not all eight port bits are used for its addressing, the rest of them are not available as inputs/outputs.

Port 3 (Pin10-17):
Port 3 is similar to Port 1. Each of these pins can serve as general input or output. Besides, all of them have alternative functions:
  • P3.0       RXD (serial input port)
  • P3.1       TXD (serial output port)
  • P3.2       INTO (external interrupt 0)
  • P3.3       INT1 (external interrupt 1)
  • P3.4       T0   (timer 0 external input)
  • P3.5       T1 (timer 1 external input)
  • P3.6       WR (external data memory write strobe)
  • P3.7       RD (external data memory read strobe)
Port 3 also receives some control signals for Flash programming and verification.
RST (pin 9):
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.
ALE/PROG (pin 30):
Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming.  In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency, and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external Data Memory.  If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.
PSEN (pin2 9):
Program Store Enable is the read strobe to external program memory.  When the AT89C51 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.
EA/VPP (pin 31):
EA (External Access) must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH.  Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset.  EA should be strapped to VCC for internal program executions.  This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming, for parts that require 12-volt VPP.

Keyword: Embedded System, Microcontroller

No comments:

Post a Comment