Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Embedded Controller Hardware Design (Ken Arnold, 2000).pdf
Скачиваний:
219
Добавлен:
12.08.2013
Размер:
1.35 Mб
Скачать

207CHAPTER TEN

Other Useful Stuff

Benchmarks

Benchmarks are short, self-contained programs which perform a critical part of an application—such as a sorting algorithm—that are used to compare functionally equivalent code on different machine. The programs are run for some number of iterations, and the time is measured and compared with that of other CPUs. The weakness here is that the benchmark is not only a measure of the processor, but also of the programmer and the tools used to implement the program. As a result, the best benchmark is the one you write yourself, since it allows you to discover how efficiently the code you write will execute on a given processor with the tools available. That’s as close to the real application performance as you’re likely to get, short of fully implementing the application on each processor under evaluation.

Device Selection Process

In selecting a device from a field of several devices, there is more to be considered than just the speed of the processor. Some factors, such as the availability of secondary suppliers may be an absolute requirement in some applications. In order to make a systematic evaluation and selection of the best alternative, the following method has proved to be valuable, particularly when the selection process must be documented and justified. The process consists of three major steps: eliminating the alternatives that are completely inappropriate, ranking the remaining options, and evaluating the adverse consequences of a catastrophic event.

The three decision matrices are:

1)Pass/fail criteria for elimination of non-conforming alternative.

2)Weighted scoring of parametric values to rank options.

3)Consideration of adverse consequences, including their probability and severity

The first matrix consists of a table with all the options on one axis and all the “must have” criteria on the other axis. Each criterion is checked off for each option. The second matrix consists of the surviving options from the first matrix on one axis of a table, and a list of quantitative measures on the other

208EMBEDDED CONTROLLER

Hardware Design

axis, along with a weighting factor for each measure, indicating its relative importance. Each option receives a weighted score allowing them to be ranked. Finally, each of the top ranking options is evaluated with respect to probability of occurrence. For instance, a dual source part that both manufacturers produce in the Silicon Valley could become totally unavailable from either source in the event of a major earthquake in that region. In that case, even though the probability of occurrence is very low, the consequences are very severe; production could be interrupted for a very long time from both sources simultaneously, causing the product they’re designed into to stop shipping for an indefinite period of time.

11

 

CHAPTER ELEVEN

209

Other Interfaces

Many of the more advanced microcontrollers come with extensive enhancements to simplify their interface with real-world devices. There are a large number of sensors and actuators that can be interfaced to a microcontroller. Common sensors indicate parameters which include temperature, pressure, position, speed, flow rate, strain, torque, volume, density, magnetic compass heading, light level, concentrations of gases, and many more. Because of the application of semiconductor fabrication technology to many of these sensors, the cost, complexity, and accuracy have improved significantly. There are also several low cost output devices and actuators available for use with microcontrollers, including LEDs, LCDs, radio control servos, “muscle wire” that changes length when a current runs through it, and piezoelectric transducers, among others.

In many cases, these sensors and transducers inputs and outputs can be processed using simple I/O devices commonly available on most microcontrollers.

Non-contact proximity sensors are available which put out a frequency or phase signal that is proportional to position. A simple counter can be used to measure the frequency or timing of the signals from such devices.

A three-pin IC is available which contains all the circuitry necessary to convert the temperature into a serial digital value that can be read by a micro (Dallas DS1620).

A simple magnetic compass provides heading information in serial digital format, or as an output voltage proportional to heading.

There are also many different options for connecting and communicating with these devices, including IR (infra-red light), radio, AC carrier current, and several variations on traditional wired connections.

210EMBEDDED CONTROLLER

Hardware Design

Analog Signal Conversion

Many types of embedded computer applications must deal with information that is not inherently digital by nature. Real world signals, such as temperature and pressure, are inherently analog signals. Analog signals are continuously variable in amplitude and must be converted to discrete digital approximations for use in digital processors. Real analog values can only be approximated with a discrete digital value. As noted in previous chapters, devices that convert from the continuously variable form to the discrete form of representation are called analog to digital converters (ADC or A/D). Similarly, there are devices that convert from digital to analog form, called digital to analog converters (DAC or D/A). Since analog values may vary continuously over time, it is also necessary to sample these varying values to allow conversion to a single value. Sampling is like taking a “snapshot” of a changing value at one point in time, similar to the way a moving object is frozen at one point in time by a strobe light. An analog device, known as a sample and hold (S/H or SAH) is used to take the snapshot using a switch and a capacitor to sample and store an analog value. After an analog signal is sampled, it can be converted to digital form by an A/D converter. The digital approximation of the sampled analog value can then be used by the processor and later converted back to an analog value by a DAC, if required. This is the general approach used to record and playback speech in a digital answering machine (this will be discussed later in this chapter).

Some microcontrollers include A/D converter hardware, with as many as eight analog inputs. Most devices do not have an internal DAC, but some have a pulse width modulated (PWM) digital output instead, which can be used in place of a conventional DAC. The PWM waveform is most often generated by operating one or more of the microcontroller’s timer/counters in a special PWM count mode. The PWM output has a rectangular wave output with a duty cycle that can be programmed between 0 and 100%. By averaging or integrating the PWM output with a filter, it is possible to get an analog value from this inherently digital counter output. In some cases the averaging is part of the output device’s inherent characteristics. One example is an electric motor that will respond to the average value of the voltage applied to it. The rotational inertia of the motor provides the averaging of the variable duty cycle digital waveform applied to it. A resistive heating element also responds to the average level applied to it due to a relatively slow thermal time constant.