Now we will see the Introduction to the Embedded System and 8051.
Introduction to the embedded system and 8051
An embedded system is a computer system designed for specific control functions within a larger system, often with real-time computing constraints. Embedded systems control many devices in common use today. Embedded systems contain processing cores that are either microcontrollers or digital signal processors (DSP). The key characteristic, however, is being dedicated to handle a particular task. Since the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size and cost of the product and increase reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale.
Physically, embedded systems range from portable devices such as digital watches and MP3 players to large stationary installations like traffic lights, factory controllers. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals, and networks mounted inside a large chassis or enclosure.
Variety of Embedded System
- Embedded systems are widespread in consumer, industrial, commercial, and military applications.
- Telecommunications systems employ numerous embedded systems from telephone switches for the network to mobile phones at the end-user.
- Consumer electronics include personal digital assistants (PDAs), mp3 players, mobile phones, video game consoles, digital cameras, DVD players, GPS receivers, and printers. Many household appliances, such as microwave ovens, washing machines, and dishwashers, include embedded systems to provide flexibility, efficiency, and features.
- Transportation systems from flight to automobiles increasingly use embedded systems. New airplanes contain advanced avionics such as inertial guidance systems and GPS receivers that also have considerable safety requirements. Various electric motors — brushless DC motors, induction motors, and DC motors — use electric/electronic motor controllers.
- Automobiles, electric vehicles, and hybrid vehicles increasingly use embedded systems to maximize efficiency and reduce pollution. Other automotive safety systems include an anti-lock braking system (ABS), Electronic Stability Control (ESC/ESP), traction control (TCS), and automatic four-wheel drive.
- Medical equipment is continuing to advance with more embedded systems for vital signs monitoring, electronic stethoscopes for amplifying sounds, and various medical imaging (PET, SPECT, CT, MRI) for non-invasive internal inspections.
Processors in Embedded System
- Embedded processors can be broken into two broad categories. Ordinary microprocessors (μP) use separate integrated circuits for memory and peripherals. Microcontrollers (μC) have many more peripherals on-chip, reducing power consumption, size and cost.
- Word lengths vary from 4-bit to 64-bits and beyond, although the most typical remain 8/16-bit. Most architecture comes in a large number of different variants and shapes, many of which are also manufactured by several different companies.
- A long but still not exhaustive list of common architectures are: 65816, 65C02, 68HC08, 68HC11, 68k, 78K0R/78K0, MCS51, ARM, AVR,AVR32, Blackfin, C167, Coldfire, COP8, CortusAPS3, eZ8, eZ80, FRV, H8, HT48, M16C, M32C, MIPS, MSP430, PIC, PowerPC,R8C, RL78, SHARC, SPARC, ST6, SuperH, TLCS-47, TLCS-870, TLCS-900, TriCore, V850, x86, XE8000, Z80, AsAP and others.
Embedded Systems talk with the outside world via peripherals, such as:
- Serial Communication Interfaces (SCI): RS-232, RS-422, RS-485
- Synchronous Serial Communication Interface: I2C, SPI, SSC, and ESSI (Enhanced Synchronous Serial Interface)
- Universal Serial Bus(USB)
- Multi-Media Cards (SD Cards, Compact Flash, etc.)
- Networks: Ethernet, Lon Works, etc.
- Field buses: CAN-Bus, LIN-Bus, PROFIBUS, etc.
- Timers: PLL(s), Capture/Compare, and Time Processing Units
- Discrete IO: aka General Purpose Input/output(GPIO)
- Analog to Digital/Digital to Analog (ADC/DAC)
- Debugging: JTAG, ISP, ICSP, BDMPort, BITP, and DP9 ports.
Introduction to the 8051 (MCS51)
Despite it is relatively old age, the 8051 is one of the most popular microcontrollers in use today. Many derivative microcontrollers have since been developed that are based on–and compatible with–the 8051. Thus, the ability to program an 8051 is an important skill for anyone who plans to develop products that will take advantage of microcontrollers.
Types of Memory
- The MCS51 has three very general types of memory. To effectively program the 8051 it is necessary to have a basic understanding of these memory types.
- The memory types are illustrated in the following graphic. They are On-Chip Memory, External Code Memory, and External RAM.
- On-Chip Memory refers to any memory (Code, RAM, or other) that physically exists on the microcontroller itself. On-chip memory can be of several types, but we’ll get into that shortly.
- External Code Memory is code (or program) memory that resides off-chip. This is often in the form of an external EEPROM.
- External RAM is RAM memory that resides off-chip. This is often in the form of standard static RAM or flash RAM.
SFR (Special Function Registers)
The MCS51 is a flexible microcontroller with a relatively large number of modes of operation. Your program may inspect and/or change the operating mode of the MCS51 by manipulating the values of the MCS51’s Special Function Registers (SFRs).
SFRs are accessed as if they were normal Internal RAM. The only difference is that Internal RAM is from address 00h through 7Fh whereas SFR registers exist in the address range of 80h through FFh.
Each SFR has an address (80h through FFh) and a name. The following chart provides a graphical presentation of the MCS51’s SFRs, their names, and their address.
As you can see, although the address range of 80h through FFh offers 128 possible addresses, there are only 21 SFRs in a standard MCS51. All other addresses in the SFR range (80h through FFh) are considered invalid. Writing to or reading from these registers may produce undefined values or behavior.
The Intel MCS51 contains two separate buses for the program and data. It is based on an 8-bit central processing unit with an 8-bit accumulator and another 8-bit register as main processing blocks. AT89C51 is supported with on-chip peripheral functions like I/O ports, Timers/Counters, serial communication ports.
The key features of AT89C51 are
- 4K Bytes of In-System Reprogrammable Flash Memory
- – Endurance: 1,000 Write/Erase Cycles
- Fully Static Operation: 0 Hz to 24 MHz
- Three-level Program Memory Lock
- 128 x 8-bit Internal RAM
- 32 Programmable I/O Lines
- Two 16-bit Timer/Counters
- Six Interrupt Sources
- Programmable Serial Channel
- Low-power Idle and Power-down Modes
VCC: Supply voltage.
PORT 0 :
Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to Port 0 pins, the pins can be used as high impedance inputs.
Port 0 may also be configured to be the multiplexed low order address/data bus during access to external program and data memory.
In this mode, P0 has internal Pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pullups are required during program verification.
PORT 1 :
Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the internal pullups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pullups.
Port 1 also receives the low-order address bytes during Flash programming and verification.
PORT 2 :
Port 2 is an 8-bit bi-directional I/O port with internal pullups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the internal pullups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pullups.
Port 2 emits the high-order address byte during fetches from external program memory and during access to external data memory that uses 16-bit addresses (MOVX @ DPTR). This application, it uses strong internal pull-ups when emitting 1s. During access to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register.
Port 2 also receives the high-order address bits and some control signals during Flash programming and verification.
PORT 3 :
Port 3 is an 8-bit bi-directional I/O port with internal pullups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the internal pullups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pullups.
Port 3 also serves the functions of various special features
of the AT89C51 as listed below:
Port 3 Functions :
Port 3 also receives some control signals for Flash programming and verification.
Port 3 also receives some control signals for Flash programming and verification.
Reset input. A high on this pin for two machine cycles, while the oscillator is running, reset the device.
Address Latch Enable output pulse for latching the low byte of the address during an access to external memory. This pin is also the program pulse input (PROG) during Flash programming.
In normal operation, ALE has 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.
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.
External Access Enable. EA 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.
XTAL1: Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2: Output from the inverting oscillator amplifier is XTAL2 pin.
In our next tutorial, we will see how to install Keil for 8051 development.
You can also read the below tutorials.