This article is Part I of a series of articles which is an attempt to introduce the reader into the world of embedded systems and their applications in the industry. I have decided to divide the topic into several parts that will be presented gradually as I complete them. The objective of the series will be a general discussion of embedded systems and what they are. In the process, I will also show how to assemble a basic robot using a robotics kit provided by Parallax which will be controlled through the BASIC Stamp II microcontroller. Towards the end of the series, I will start using the Microsoft Robotics Studio to illustrate some of the features available through the new IDE provided by Microsoft, if time permits.
So what is an embedded system? In general terms, an embedded system is any device that includes a programmable computer for a specific task. Sometimes it is also said that, an embedded system is nearly any computing system other than a desktop computer. Embedded systems are found everywhere these days! Your cell phone, digital camera, portable video games, calculators, digital watches, and etc… the list can go on for a really long time. This gives you an idea of the broad application base of embedded systems.
Understanding of computer architecture and microcontrollers is a plus for this series of articles. I will be discussing system design and theoretical concepts of microprocessor. Also some basic electronics knowledge would be helpful once we get into circuit design for the robot. All this will be provided and I will try to make it a good learning experience.
Characteristics of Embedded Applications
Embedded systems have several common characteristics that distinguish them from other computing systems: Single Function, Tightly Constrained, and Reactive to Real Time.
- Single Function: An embedded system usually executes a specific program repeatedly.
- Tightly Constrained: All computing systems have constraints on design metrics, but these constraints can be extremely tight on embedded systems.
- Reactive and Real Time: must continually react to changes in the system's environment and must compute certain results in real time without delay.
An example of a real time embedded system is the computing systems in most of modern day cars. For example, BMW uses highly sensitive and sophisticated embedded systems to make the ride a better and safer experience for the driver. The 5 series, for example, makes several million calculations per second and uses this information to make proper adjustments to the critical components of the vehicle. Let's take a closer look at some of these components for a better understanding.
ABS (Antilock Brake System) and (ASC+T) Automatic Stability Control + Traction
An antilock brake system reduces skidding by pumping the brakes. An automatic stability and control system intervenes with the engine during maneuvering to improve the car's stability. These systems actively control critical systems of the car.
With ABS, sensors measure the speed at which the wheels are turning. If this decreases rapidly, the electronic steering system reports blocking danger. The pressure of the hydraulics is reduced immediately and then raised to just under the blocking threshold. The process can be repeated several times per second, and you can notice it by the pulsation on the brake pedal.
To improve ABS, BMW places a sensor on every single wheel. The advantage of 4 sensors is the higher regulation precision. By sensing 4 individual rpm's of the wheels, the braking power on the rear axle can be adjusted with a great deal more sensitivity.
BMW's four wheel-speed sensors are in constant contact with all four wheels, providing greater accuracy than systems that use just three sensors. Each sensor carries accurate feedback from a specific wheel independently. A three-sensor system provides an average wheel-speed figure for rear wheels.
Automatic Stability Control + Traction is a suspension control system that reduces engine output, until the vehicle can move or acceleration can take place, without the wheels spinning. This happens regardless of how the driver is using the accelerator. If the reduction in acceleration is not enough, each drive wheel is braked individually until both wheels have optimum traction. Braking is under control of the BMW pioneered Anti-lock Braking System (ABS) system.
Intelligent regulation systems prevent the vehicle from swerving when accelerating on a loose surface, insuring that directional stability is reliably maintained.
- If a wheel threatens to spin, the wheel brake is applied or else the system intervenes to regulate the engine management accordingly. Only so much throttle is applied to insure lateral stability, even if the accelerator is fully depressed.
- An integrated engine drag torque regulation system stops the drive wheels from blocking if the driver suddenly removes his foot from the accelerator.
- The system can be switched off if you desire.
The ABS and ASC+T systems must clearly communicate because the ASC+T interacts with the brake system. Since the ABS was introduced several years earlier than the ASC+T, it was important to be able to interface ASC+T with the existing ABS module, as well as other existing embedded modules. The engine and control management units include the electronically controlled throttle, digital engine management, and electronic transmission control. The ASC+T control unit has two microprocessors, one of which concentrates on logic-relevant components, and the other on performance specific components.
Now that we have seen an example of a real world embedded system and its usefulness, let us concentrate on the technology itself.
Processor technology relates to the architecture of the computation engine used to implement a system's desired functionality.
General Purpose Processors: The designer of a general purpose processor or a microprocessor builds a programmable device that is suitable for a variety of applications to maximize the devices sold.
Single Purpose Processor: A single purpose processor is a digital circuit designed to execute exactly one program.
Application Specific Processor: An application specific instruction set processor (ASIP) can serve as a compromise between the general purpose processor and the single purpose processor. As ASIP is a programmable processor optimized for a particular class of applications having common characteristics, such as embedded control, digital-signal processing, or telecommunications.
Using a general purpose processor in an embedded system may result in several design benefits. Flexibility is high because changing functionality requires changing only the program. Time to market would be low, and unit cost would be low in small quantities compared to designing your own processors. Performance may not be as great for some more computation intensive applications.
Using a single purpose processor in an embedded system results in several design metric benefits. Performance may be fast, size and power may be small, and unit cost may be low for large quantities.
Using an ASIP in an embedded system can provide the benefit of flexibility while still achieving good performance, power and size. Microcontrollers and digital signal processors are two well known types of ASIPs that have been used for several decades. A microcontroller is a microprocessor that has been optimized for embedded control applications.
Digital signal processors (DSPs) are another common type of ASIP. A DSP is a microprocessor designed to perform common operations on digital signals, which are the digital encoding of analog signals likes video and audio.
We will be more concentrating on general purpose processors.
General Purpose Processors
A general purpose processor is a programmable digital system intended to solve computational problems in a large variety of applications.
The same processor can be used to solve computational problems in applications as diverse as communication, automotive, and industrial embedded systems.
A general purpose processor consists of a data path and a control unit tightly linked with a memory.
The datapath consists of the circuitry for transforming data from and for storing temporary data. It consists of an arithmetic logic unit (ALU) capable of transforming data through operations such as addition, subtraction, logical AND, logical OR, inverting and shifting.
The datapath also contains registers capable of storing temporary data. Processors are typically distinguished by their size, and we usually measure the size of the processor as the bit width of the datapaths components. Common processor sizes include, 4-bit, 8-bit, 16-bit, 32-bit and 64-bit. The processor which we will be using for our robot construction is a 16-bit general purpose processor.
In some cases a particular processor may have different sizes among its registers, ALU, internal bus or external bus. For example, a processor may have a 16-bit internal bus, ALU and registers, but have old 8-bits of external but to reduce the number of pins on the processor's IC.
We will discuss the processor in more detail in the second part of the article.
The control unit consists of circuitry for retrieving program instructions and for moving data to, from and through the datapath according to those instructions.
For each instruction the controller typically sequences through several stages, such as fetching the instruction from memory, decoding it, fetching operands, executing the instruction in the datapath, and storing the results. Each stage may consists of one or more clock cycles. A clock cycle is usually the longest time required for data to travel from one register to another.
While registers server a processor's short-term storage requirements, memory server the processor's medium and long-term information-storage requirements. We can classify storage information as either program or data.
Program information consists of the sequence of instruction that cause the processor to carry out the desired system functionality. Data information requests the values being input, output and transformed by the program.
Points of Interest
This introduction is only a scratch on the surface of computer architecture. It covers the basic ideas and gives a footing for the reader for the remaining parts of the article series. There are a lot of good books on computer architecture available that you can study to get a deeper understanding of the subject. I will list some of the books that I have used and think that are worthwhile for reading and reference.
- Computer Organization, by Carl Hamacher, Zvonko Vranesic, Safwat Zaky
- Computer Architecture: A Minimalist Perspective (The International Series in Engineering and Computer Science) (Hardcover), by William F. Gilreath, Phillip A. Laplante
There are of course more books on the subject which you might want to consider. Keep in mind the objective of this article is not computer design and architecture, but how to use the concepts to implement a simple embedded system; we will use a robot to demonstrate the concepts.