440 likes | 685 Views
Microprocessor and Microcontrollers (CSE-3511) Lecture- (Embedded Systems and Microcontrollers). Sazid Zaman Khan. Embedded Systems. An Embedded system is any electronic device that incorporates a computer in its implementation.
E N D
Microprocessor and Microcontrollers (CSE-3511)Lecture- (Embedded Systems and Microcontrollers) SazidZaman Khan
Embedded Systems • An Embedded system is any electronic device that incorporates a computer in its implementation. • The user of an embedded device is often not even aware that a computer is present in the device. The computer is used primarily to provide flexibility and to simplify the system design. • Unlike a PC, program code is usually stored in ROM and not a hard disk drive. • Typically, the end user does not develop new software for the embedded device. With advances in VLSI technology, embedded systems have become so inexpensive that they are found in most of today’s electronic devices.
Embedded system • A personal computer, even though it contains a microprocessor is not an embedded system. It’s end function is to compute, even if the same computer was connected to a set of instruments, which it controlled, it would not be an embedded system. If however the same computer was built into an identifiable system so that it’s sole purpose was to control one system, it would then be called an embedded system.
Examples of Embedded systems • Embedded devices can be found in a wide array of products including aircraft and military systems, biomedical systems, cars, communications, computer I/O devices, electronic instrumentation, home electronics, industrial equipment, office machines, personal devices, robots, and smart toys.
Characteristics of Embedded Systems • Embedded systems must be reliable. • Many embedded devices can’t crash, and may not be able to reboot. • Software can’t be updated in many embedded devices. • Many devices have critical performance & power design constraints. • Real-time constraints occur in many applications and • Many devices have limited memory and processing power. • Some devices may need to run on battery power for long periods of time.
Hardware Software Partitioning during embedded system design
Hardware Software Co-Design • There is strong need to explore the design space efficiently in order to meet the goals of cost, performance and power consumption. In order to consider the tradeoffs, there is a need to design the system taking into account the interaction between hardware and software components. This has led to the field of hardware-software co-design and partitioning. • The co-design of embedded systems involves: • Co-specification: Creating specifications that describe both hardware and software elements (and the relationship between them); • Co-synthesis: Automatic or semi-automatic design of hardware and software to meet a specification; • Co-Simulation: Simultaneous simulation of hardware and software elements, often at different levels of abstraction.
Specification and Modeling of the Embedded system (for an elevator)
Modeling Embedded system behavior with Finite State machine models
Modeling Embedded system behavior with Finite State machine models
System on Chip (SoC) • A system on a chip or system on chip (SoC or SOC) is an Integrated Circuit (IC) that integrates all components of a computer or other electronic system into a single chip. A typical application is in the area of embedded systems. The contrast with a microcontroller is one of degree. Microcontrollers typically have under 100 kB of RAM (often just a few kilobytes) and often really are single-chip-systems, whereas the term SoC is typically used with more powerful processors, capable of running software such as the desktop versions of Windows and Linux, which need external memory chips (flash, RAM) to be useful, and which are used with various external peripherals.
System on Chip components • A typical SoC consists of: • A microcontroller or microprocessor. • Memory blocks including ROM, RAM, Flash memory. • Timing sources including oscillators. • Peripherals including counter-timers. • External interfaces including industry standards such as USB, Ethernet, etc. • Voltage regulators.
The 8051 micro-controller (From michael J. Pont’s text upto slide-35) • Many embedded systems are based on the 8051 family of micro-controllers. 8051 architecture – originally developed by Intel – is now implemented in more than 400 chips; these are produced by a diverse range of companies including Philips, Infineon, Atmel and Dallas. Sales of this vast family are estimated to have the largest share (around 60%) of the microcontroller market as a whole, and to make up more than 50% of the 8-bit microcontroller market. • Versions of the 8051 are currently used in a long list of embedded products, from automotive systems to children’s toys
Link between clock frequency, performance and machine cycle period • All digital computer systems are driven by some form of oscillator circuit: the 8051 is certainly no exception
Link between clock frequency, performance and machine cycle period
Why you should choose a low oscillator frequency • All digital computer systems are driven by some form of oscillator circuit: the 8051 is certainly no exception. • Many applications do not require the levels of performance that a modern 8051device can provide. • In most modern (CMOS-based) 8051s, there is an almost linear relationship between the oscillator frequency and the power supply current. As a result, by using the lowest frequency necessary it is possible to reduce the power requirement: this can be useful, particularly in battery-powered applications
Why you should choose a low oscillator frequency • When accessing low-speed peripherals (such as slow memory, or liquid-crystal displays), programming and hardware design can be greatly simplified – and the cost of peripheral components, such as memory latches, can be reduced – if the chip is operating more slowly. • The electromagnetic interference (EMI) generated by a circuit increases with clock frequency.
8051memory architecture (8051 data memory) • Note that the various locations can be accessed either via their byte addresses (0x20 to 0x2F) or via their bit addresses (0x00 to 0x7F). • Note also that there is an area where the bit addresses and the byte addresses are the same. For example, within byte address 0x24, there is a bit location with address 0x27: there is also a byte with address 0x27 in the BDATA area. It may appear that this will cause problems for the compiler. However, no conflicts will arise because the compiler can always determine from the context (that is, the type of data being manipulated) whether the bit address or byte address should be used.
8051memory architecture (8051 code memory) • The CODE area is used to store the program code, usually in some form of ROM (’read-only memory’).
8051-8 bit microcontroller with 16 bit data bus • The Standard 8051 can be described as an 8-bit microcontroller with a 16-bit address space. • Here the fact that it is an ‘8-bit microcontroller’ refers to the size of the registers and data bus. This means that the family will handle 8-bit data very quickly and process 16-bit or 32-bit data rather less efficiently. • The 16-bit address space means that the device can directly address 2^16 bytes of memory: that is, 64 kbytes.
I/O (Input/Output pins) • Most 8051s have four 8-bit ports, giving a total of 32 pins you can individually read from or control. All of the ports are bidirectional: that is, they may be used for both input and output.
Timers • All members of the 8051 family have at least two timer/counters, known as Timer 0 and Timer 1: most also have an additional timer (Timer 2). These are 16-bit timers, which means they can hold values from 0 to 65535.
Functions of 8051 timers • We can use it to measure intervals of time. For example, we can measure the duration of a function by noting the value of a timer at the beginning and end of the function call, and comparing the two results. • We can use it to generate precise hardware delays. • We can use it to generate ‘time out’ facilities: this is a key requirement in systems with real-time constraints.
8051 interrupts • The original ‘8051’ (‘8052’) architecture supported seven types of interrupt sources: • Two counter interrupts. • Two UART-related interrupts. (A UART (Universal Asynchronous Receiver/Transmitter) is the chip with programming that controls a computer's interface to its attached serial devices. • Two external interrupts. • The ‘power-on reset’ (POR) interrupt.
Serial interface • The 8051 has a serial port compatible with what is commonly referred to as the RS-232 communication protocol. This allows you to transfer data between an 8051 microcontroller and some form of personal computer (desktop PC, notebook PC or similar). • The serial port may be used to debug embedded applications, using a desktop PC.
Power consumption issues of 8051micro-controller • To achieve longer battery life, all modern implementations of 8051 processors have at least three operating modes: • Normal mode. • Idle Mode. • Power-Down Mode.
A simple 8051 microcontroller programming example (From the textbook ‘8051 tutorial’-Donalheffernan)
A simple 8051 microcontroller programming example (‘8051 tutorial’-Donalheffernan -31-35p (I provided this text)) (SFR =Special Function Register)
Displaying different zone numbers on 7-segment depending on active zone (see- ‘8051 tutorial’-Donalheffernan -34p)
Hello Embedded World Program in C (From textbook ‘Embedded C- Michael Pont-43-51p’)- for slide 42-51
See the complete code • See ‘Embedded C- Michael Pont-43-51.