You are on page 1of 20

Concepts of Embedded System

Keltron

Embedded system
If we look around, we will find ourselves to be surrounded by computing systems. Every year millions of computing systems are built destined for desktop computers (Personal Computers, workstations, mainframes and servers) but surprisingly, billions of computing systems are built every year embedded within larger electronic devices and still goes unnoticed. Any device running on electric power either already has computing system or will soon have computing system embedded in it. What constitutes an embedded system? Is it a piece of Hardware? Or is it software? Or is it a combination of both? The word Embedded System refers to A Computer (similar to Desktop or Laptop) which has been designed to do specialized tasks (unlike Desktop or Laptop). A desktop is designed to serve as a general purpose computer - it can perform a variety of functions (can act as a music system, as a business machine, as a software development platform etc). Whereas, an embedded system is designed for only a specific functionality (e.g. a Vending machine, or Media Player or a Printer). The resources (memory and processor bandwidth) are tightly constrained in an embedded system. Also the software which runs in embedded system generally has a close control over the system hardware. A very simple example of Embedded Systems is Washing Machine Controller. In a washing machine controller (any controller for that matter), a Micro-controller forms the heart of the system (this is the basic underline Hardware), and thin software layers on the top of this hardware add different functionalities to the controller. Different Software functions will be called (executed) based on user input from the keypad (again a hardware), which sits on top of the software layers. The hardware and software layers in this system are closely intermingled, with software lying some where in between (being embed) hardware layers.

Keltron

Keltron

Embedded System-Some popular definitions


A precise definition of embedded systems is not easy An embedded system is any electronic system that uses a CPU chip, but that is not a general purpose workstation, desktop or laptop computer.

An embedded system is a special-purpose computer system designed to perform a dedicated function. Unlike a general-purpose computer, such as a personal computer, an embedded system performs one or a few pre-defined tasks, usually with very specific requirements, and often includes task-specific hardware and mechanical parts not usually found in a general-purpose computer. Block diagram of a typical embedded system is shown in fig.

Keltron

Keltron

ELEMENTS OF EMBEDDED SYSTEMS

Hardware Core element of an embedded system is the processor or a computational unit. Processors can act as brain of the system. They can be programmed to do perform a task. This can be designed using variety of options. General Purpose Microprocessors General purpose microprocessors are single chip semi conductor device which is a computer on chip, but not a complete computer. Its CPU contains an Arithmetic & Logic Unit (ALU), a Program Counter (PC), a Stack Pointer (SP), registers, a clock and interrupts circuit on a single chip. To make complete micro computer, one must add memory usually ROM and RAM, memory decoder, an oscillator, a number of serial and parallel ports

A general-purpose processor is designed to cater for large amount of applications and hence is produced in bulk. Using it in an embedded system offers various benefits. Design time is low as only software is to be developed, no digital design is involved. Typical characteristics of general purpose processors are relatively high cost, high speeds, higher Power consumption, large architecture, large memory size, onboard flash and cache, an external bus interface for greater memory usage. Examples: Motorolas 680x0, Intels x86

Keltron

Keltron

Microcontrollers/ Embedded Processors

A microcontroller is a functional computer system-on-a-chip. It contains an integrated processor, memory (a small amount of RAM, program memory, or both), several peripheral devices, such as timers, analog to digital converters, and serial communication devices all on one chip resulting in compact and low-power implementations. It is not expandable as it has no external bus interface. Examples are PICs DSPIC33 / PIC24, Motorolas 6811, Intels 8051 Typical characteristics of a microcontroller are: Low cost, Low speed, Low Power, small architecture, Small memory size, Onboard Flash, Limited I/O.

Microcontrollers provide pin access which allows programs to easily monitor sensors, set actuators, and transfer data with other devices. Providing specialized instructions improves performance for embedded systems applications; thus, microcontrollers can be considered ASIPs to some degree. Special microcontrollers are often called embedded processors. The difference between a microcontroller and an embedded processor is not clear, but processors with large architectures with fast processing, fast context-switching & atomic ALU operations are marketed by many vendors as embedded processors. Examples of embedded processors are ARM7, INTEL i960, AMD 29050

Keltron

Keltron

RELEVANT IMPORTANT CONCEPTS 1. Computer Architecture

Two common prevalent processor architectures are Neumann Vs Harvard. Von Neumann architectures have same program and data memory space; both shares address bus and data bus. Harvard architecture has different memory space for program and data. For each of them, separate data bus and address bus are provided.

Keltron

Keltron

2.

Instruction Set Architecture (ISA)

ISA

serves

as

an

abstraction

layer

between

the

software

and

hardware. Reduced Instruction Set Computer (RISC) and Complex Instruction Set Computer (CISC) stand for two different competing philosophies in designing modern computer architecture. RISC has simple primitive instructions and addressing modes. The instructions are of uniform length, execute in one clock cycle & support pipelining. CISC chips have a large amount of variable length, different and complex instructions and take longer than a clock cycle to execute. CISC chips are relatively slow per instruction compared to RISC chips, but use fewer instructions than RISC. Thus, RISC systems shorten execution time by reducing the clock cycles per instruction, whereas CISC shorten execution time by reducing MIPS R2000 is a typical product of pure RISC and Intel 80386 is a typical kind of pure CISC chip.

Keltron

Keltron

Introduction to Embedded C
Looking around, we find ourselves to be surrounded by various types of embedded systems. Associated with each processor is the embedded software. If hardware forms the body of an embedded system, embedded processor acts as the brain, and embedded software forms its soul. It is the embedded software which primarily governs the functioning of embedded systems.

During infancy years of microprocessor based systems, programs were developed using assemblers and fused into the EPROMs. There used to be no mechanism to find what the program was doing. LEDs, switches, etc. were used to check correct execution of the program.

As time progressed, use of microprocessor-specific assembly-only as the programming language reduced and embedded systems moved onto C as the embedded programming language of choice. C is the most widely used programming language for embedded processors/controllers. Assembly is also used but mainly to implement those portions of the code where very high timing accuracy, code size efficiency, etc. are prime requirements.

Initially C was developed by Kernighan and Ritchie to fit into the space of 8K and to write (portable) operating systems. Originally it was implemented on UNIX operating systems. As it was intended for operating systems development, it can manipulate memory addresses. Also, it allowed programmers to write very compact codes. This has given it the reputation as the language of choice for hackers too. As assembly language programs are specific to a processor, assembly language didnt offer portability across systems. To overcome this disadvantage, several high level languages, including C, came up. Some other languages like PLM, Modula-2, Pascal, etc. also came but couldnt find wide acceptance. Amongst those, C got wide acceptance for not only embedded systems, but also for desktop applications. Even though C might have lost its sheen as mainstream language for general purpose applications, it still is having a strong-hold in embedded programming. Due to the wide acceptance of C in the embedded systems, various kinds of support tools like compilers & crosscompilers, ICE, etc. came up and all this facilitated development of embedded systems using C.

Keltron

Keltron

EMBEDDED SYSTEMS PROGRAMMING

Embedded systems programming is different from developing applications on a desktop computers. Key characteristics of an embedded system, when compared to PCs, are as follows: Embedded devices have resource constraints (limited ROM, limited RAM, limited stack

space, less processing power) Components used in embedded system and PCs are different; embedded systems typically Embedded systems are more tied to the

uses smaller, less power consuming components. hardware.

Two salient features of Embedded Programming are code speed and code size. Code speed is governed by the processing power, timing constraints, whereas code size is governed by available program memory and use of programming language. Goal of embedded system programming is to get maximum features in minimum space and minimum time.

Embedded systems are programmed using different type of languages: Machine Code Low level language, i.e., assembly High level language like C, C++, Java, Ada, etc. Application level language like Visual Basic, scripts, Access, etc.

Assembly language maps mnemonic words with the binary machine codes that the processor uses to code the instructions. Assembly language seems to be an obvious choice for programming embedded devices. However, use of assembly language is restricted to developing efficient codes in terms of size and speed. Also, assembly codes lead to higher software development costs and code portability is not there. Developing small codes are not much of a problem, but large programs/projects become increasingly difficult to manage in assembly language. Finding good assembly programmers has also become difficult nowadays. Hence high level languages are preferred for embedded systems programming.

Keltron

Keltron

Microcontrollers and IDEs

8051 (89C51, 89S51, 89V51)


The Intel MCS-51 (commonly referred to as 8051) is a Harvard architecture, single chip microcontroller (C) series which was developed by Intel in 1980 for use in embedded systems. Intel's original versions were popular in the 1980s and early 1990s. IDE: Kiel, Programming: C, ASM

PIC-Microchip (PIC16F877A, 18F452) PIC is a family of modified Harvard architecture microcontrollers made by Microchip

Technology, derived from the PIC1650[1][2][3] originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to "Peripheral Interface Controller" PICs are popular with both industrial developers and hobbyists alike due to their low cost, wide availability, large user base, extensive collection of application notes, availability of low cost or free development tools, and serial programming (and re-programming with flash memory) capability. IDE: Mplab Programming: C, ASM

Keltron

Keltron

ATMEL AVR (ATMega128, Atmega328)

The AVR is a modified Harvard architecture 8-bit RISC single chip microcontroller which was developed by Atmel in 1996. The AVR was one of the first microcontroller families to use onchip flash memory for program storage, as opposed to one-time programmable ROM,EPROM, or EEPROM used by other microcontrollers at the time. IDE: Arduino, AVR studio Programming: C, ASM TI MSP430 The MSP430 is a mixed-signal microcontroller family from Texas Instruments. Built around a 16-bit CPU, the MSP430 is designed for low cost and, specifically, low power consumption embedded applications. Free Compiler and IDEs

TI Code Composer Studio IDE, Microcontroller Core Edition (size limited to 16KB) IAR Embedded Workbench Kick start IDE (size limited to 4/8/16KB - depends on device used)

ARM (ARM1,ARM9,CORTEX -M3,CORTEX-M4) ARM is a reduced instruction set computer (RISC) instruction set architecture (ISA) developed by ARM Holdings. It was named the Advanced RISC Machine and, before that, the Acorn RISC Machine. The ARM architecture is the most widely used 32-bit instruction set architecture. ARM Ltd does not manufacture or sell CPU devices based on its own designs, but rather, licenses the processor architecture to interested parties IDE: Kiel Programming: C, ASM

Keltron

Keltron

Open Source

Generically, open source refers to a program in which the source code is available to the general public for use and/or modification from its original design free of charge, i.e., open. Open source code is typically created as a collaborative effort in which programmers improve upon the code and share the changes within the community. The free software movement was launched in 1983. In 1998, a group of individuals advocated that the term free software should be replaced by open source software (OSS) as an expression which is less ambiguous and more comfortable for the corporate world.[4]Software developers may want to publish their software with an open source license, so that anybody may also develop the same software or understand its internal functioning. With open source software, generally anyone is allowed to create modifications of it, port it to new operating systems and processor architectures, share it with others or, in some cases, market it. The Open Source Definition, notably, presents an open source philosophy, and further defines the terms of usage, modification and redistribution of open source software. Software licenses grant rights to users which would otherwise be reserved by copyright law to the copyright holder. Several open source software licenses have qualified within the boundaries of the Open Source Definition. The most prominent and popular example is the GNU General Public License (GPL), which allows free distribution under the condition that further developments and applications are put under the same license thus also free.[7] While open source distribution presents a way to make the source code of a product publicly accessible, the open source licenses allow the authors to fine tune such access.

Keltron

Keltron

Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of Linux is the Linux kernel, an operating system kernel first released 5 October 1991 by Linus Torvalds.[11][12] Linux was originally developed as a free operating system for Intel x86-based personal computers. It has since been ported to more computer hardware platforms than any other operating system. It is a leading operating system on servers and other big iron systems such as mainframe computers and supercomputers:[13][14][15][16] more than 90% of today's500 fastest supercomputers run some variant of Linux,[17] including the 10 fastest.[18]Linux also runs on embedded systems (devices where the operating system is typically built into

the firmware and highly tailored to the system) such as mobile phones, tablet computers, network routers, televisions[19][20] and video game consoles; the Android system in wide use on mobile devices is built on the Linux kernel. The development of Linux is one of the most prominent examples of free and open source software collaboration: the underlying source code may be used, modified, and distributed commercially or non-commerciallyby anyone under licenses such as the GNU General Public License. Typically Linux is packaged in a format known as a Linux distribution for desktop and server use. Some popular mainstream Linux distributions include Debian (and its derivatives such as Ubuntu), Fedora and openSUSE. Linux distributions include the Linux kernel, supporting utilities and libraries and usually a large amount of application software to fulfill the distribution's intended use.

Keltron

Keltron

ANDROID

What is Android? Why its so popular? In a very short time Google's mobile operating system (OS) Android has become the number one choice for smart phones. Google's Android has overtaken Symbian and Windows mobile in terms of number of users. Research agencies across the world have confirmed this. But how did Android manage this in just a few years? Android is free Android, since the day it was launched, has been available free of cost and Google made it clear that it will be free in future as well. The OS caught the attention of manufacturers across the world and many initially adopted it for low cost smart phones. Open Source Android. Unlike other operating systems that are protected by lots of copyrights, Google chose to keep Android open for all. By doing this, the company got many programmers from around the globe to develop applications, while keeping its liabilities to a minimum. With many brains working on the system, newer and newer ideas were incorporated, which in turn helped in making Android a preferred choice Open for customization Unlike Windows or any other mobile operating system, device manufacturers are free to modify Android as per their needs. Users enjoy much needed flexibility and ease of use because manufacturers are now able to modify anything and everything they need to make the experience a pleasant one.

Keltron

Keltron

Large number of applications Android Market created an opportunity for millions of application developers around the globe to show their skills and come up with newer applications for Android phones. Its users therefore have a wide variety of applications to choose from and can customize their phones for a personal experience.

Embedded Linux
Embedded Linux is the use of Linux in embedded computer systems such as mobile phones, personal digital assistants, media players, set-top boxes, and other consumer electronics devices, networking equipment, machine control, industrial automation, navigation equipment and medical instruments. The advantages of embedded Linux over proprietary embedded operating systems include multiple suppliers for software, development and support; no royalties or licensing fees; a stable kernel; and the ability to read, modify and redistribute the source code.

Keltron

Keltron

Arduino-The open source physical computing platform

Wh at i s Ard u i n o? Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It's an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board. Arduino can be used to develop interactive objects, taking inputs from a variety of switches or sensors, and controlling a variety of lights, motors, and other physical outputs. Arduino projects can be stand-alone, or they can be communicating with software running on your computer (e.g. Flash, Processing, MaxMSP.) The boards can be assembled by hand or purchased preassembled; the open-source IDE can be downloaded for free. The Arduino programming language is an implementation of Wiring, a similar physical computing platform, which is based on the Processing multimedia programming environment. Wh y Ard u i n o? There are many other microcontrollers and microcontroller platforms available for physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard, and many others offer similar functionality. All of these tools take the messy details of microcontroller programming and wrap it up in an easy-to-use package. Arduino also simplifies the process of working with microcontrollers, but it offers some advantage for teachers, students, and interested amateurs over other systems:

Inexpensive - Arduino boards are relatively inexpensive compared to other microcontroller platforms. The least expensive version of the Arduino module can be assembled by hand, and even the pre-assembled Arduino modules cost less than $50

Cross-platform - The Arduino software runs on Windows, Macintosh OSX, and Linux operating systems. Most microcontroller systems are limited to Windows.

Simple, clear programming environment - The Arduino programming environment is easy-to-use for beginners, yet flexible enough for advanced users to take advantage of as well. For teachers,

Keltron

Keltron

it's conveniently based on the Processing programming environment, so students learning to program in that environment will be familiar with the look and feel of Arduino

Open source and extensible software- The Arduino software and is published as open source tools, available for extension by experienced programmers. The language can be expanded through C++ libraries, and people wanting to understand the technical details can make the leap from Arduino to the AVR C programming language on which it's based. Similarly, you can add AVR-C code directly into your Arduino programs if you want to.

Open

source

and

extensible

hardware

The

Arduino

is

based

on

Atmel's ATMEGA8 and ATMEGA168microcontrollers. The plans for the modules are published under a Creative Commons license, so experienced circuit designers can make their own version of the module, extending it and improving it. Even relatively inexperienced users can build the breadboard version of the module in order to understand how it works and save money. Programming Arduino The basic structure of Arduino programming language is fairly simple and runs in at least two parts. These two required parts enclose blocks of statements Void setup () { Statements } Void loop () { Statements }

Keltron

Keltron

Where setup () is initialization and loop () is execution. Both functions are required for the program to work. The setup function should follow the declaration of any variables at the very beginning of the program. It is the first function to run in the program and runs only once. The loop function follows next and includes the code to be executed continuously-reading inputs, triggering outputs etc. This function is the core of all Arduino programs and does the bulk of the work Arduino program for Blinking LED

Void setup() { pinMode(13, OUTPUT); // initialize the digital pin as an output. // Pin 13 has an LED connected on most Arduino boards: } void loop() { digitalWrite(13, HIGH); // set the LED on delay(1000); // wait for a second // set the LED off

digitalWrite(13, LOW); delay(1000); }

// wait for a second

Keltron

Keltron

Relays

A relay is an electrically operated switch. Many relays use an electromagnet to operate a switching mechanism mechanically. Relays are used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation between control and controlled circuits), or where several circuits must be controlled by one signal. Working of Relay The two terminals operates as a switch. When the contacts are 'in contact' then the current flows from Terminal 1 to Terminal 2. There are two types of contacts: the NO and the NC. NO stands for Normal Open contact, while NC stands for Normal Closed contact. The Normal Open is a contact like the one showed in the previous illustration. When the contact is still, then no current flows through it (because it is an OPEN circuit). On the other hand, a Normal Closed contact allows the current to flow when the contact is still.

Keltron

Keltron

Keltron

You might also like