Top Banner
Computing Machinery Chapter 10: Microcontrollers
51

Computing Machinery Chapter 10: Microcontrollers

Jan 28, 2016

Download

Documents

Garry

Computing Machinery Chapter 10: Microcontrollers. Microcontroller. Microprocessors vs. Microcontrollers. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Computing Machinery Chapter 10: Microcontrollers

Computing MachineryChapter 10: Microcontrollers

Page 2: Computing Machinery Chapter 10: Microcontrollers

Microprocessors vs. Microcontrollers

The primary difference between a microprocessor and a microcontroller is that the microcontroller includes more supporting functions such as on-board memory and I/O than the microprocessor.

Until recently, microcontroller units (MCU's) were considered less powerful than microprocessors, however, continued development has lead to MCU's that meet or exceed the throughput (number of equivalent instructions per second) of high-end microprocessors.

The power of some modern microcontrollers is equal to high-end CPU's but more specific in their designs and applications than general-purpose microprocessors.

Microcontrollers offer many application specific features such as I2C and CAN bus communications and video controllers.

Microcontroller

Page 3: Computing Machinery Chapter 10: Microcontrollers

Embedded Systems

An embedded system is a device or module designed for a specific purpose and based on some computational (software modifiable) element. One of the key features of an embedded system is real-time operation.

http://www.ece.cmu.edu/~koopman/iccd96/iccd96.html

Page 4: Computing Machinery Chapter 10: Microcontrollers

The Harvard Architecture separates the data and instructions into separate memory units each with their own bus. Besides speeding up the data transfer rate, separating the data from the instructions permits us to implement different bus widths and word sizes for program and data memory space.

Harvard Architecture

Page 5: Computing Machinery Chapter 10: Microcontrollers

Digital Signal Processors

Digital Signal Processors (DSP's) are types of microcontrollers that are more specialized for a particular application. DSP represent around 20% of the total MCU market.

DSP's are particularly well suited to real-time operations in which a data stream, video, audio, etc. is modified in someway as it is passed along to another device or component.

Most DSP's are based on the Harvard Architecture. DSP's commonly include analog-to-digital (A/D) conversion for their inputs and digital-to-analog (D/A) conversion of their outputs.

Page 6: Computing Machinery Chapter 10: Microcontrollers

Pulse Width Modulation

Pulse Width Modulation (PWM) - Many MCU are designed to generate variable width squarewave signals as shown below. A pulse width modulated (PWM) signal is a squarewave with a varying ratio of high and low logic levels, called the duty cycle.

The PWM signal is defined by two parameters, the frequency and the duty cycle. A 10% duty cycle signal is at a logical high 10% of the time and low 90% of the time. The average rate at which the signal oscillates between logic levels is given by the frequency in cycles per second (Hertz).

Page 7: Computing Machinery Chapter 10: Microcontrollers

Digital to Analog Conversion

A PWM signal can be filtered using passive electronic components (e.g. an RC [resistor-capacitor] network) to generate a smoothed average voltage level. A controlled voltage level or power level can be delivered using PWM signals.

Page 8: Computing Machinery Chapter 10: Microcontrollers

Serial I/O Interface (UART)

The Universal Asnychronous Receiver/Transmitter (UART) is a popular form of serial communication between digital devices.

A number of bits are presented to the UART in parallel and are then serialized, transmitted to another UART where they are converted back into a binary vector.

The UART specification does not include details of the communication details.

In fact, there are several interface standards in common use (e.g. RS232, RS422 and RS485). For embedded systems the RS232 standard is the most popular.

Page 9: Computing Machinery Chapter 10: Microcontrollers

The Serial Peripheral Interface (SPI)

This is a communications protocol used on most MCU's as an inexpensive alternative to multiple pin parallel communications. SPI is used for many applications in MCU including memory data block transfers. The SPI interface include a clock line, a data-in, a data-out and a chip enable line, named as,

SCLK - serial clock MISO - master input, slave output MOSI - master output, slave input CS - chip select (optional, usually inverted polarity)

Page 10: Computing Machinery Chapter 10: Microcontrollers

Basic-X35 Schematic

AT25256

Page 11: Computing Machinery Chapter 10: Microcontrollers

The Inter-Integrated Circuit (I2C) computer bus is used to interface many different types of peripherals to MCU's or other embedded systems when a high data throughput is not required.

The I2C uses bidirectional data and clock lines with open-collector logic. The standard data rate for the I2C is 100 kilobits/second. It also support a low-speed 10 Kbits/s or lower.

The I2C protocol is ideal for sending control signals to remote devices, collecting A/D signals from sensors and accessing slow-speed non-volatile RAM.

One of the most valuable features is that periperals can be connected and removed from the I2C bus while powered up. This is possible because of the open-collector logic in which a bus line is either set to ground or no-connection.

In open-collector circuits, a logical high is achieved by placing pull-up resistor on each open-collector line.

I2C Communications

Page 12: Computing Machinery Chapter 10: Microcontrollers

Controller Area Nework (CAN) Bus

This is a multicast shared serial bus standard. The CAN bus was designed to operate in high noise conditions, which makes it a preferred communications standard for applications involving electrical motors and internal combustion engines.

The CAN protocol uses error-correcting codes to automatically detect and recover bit errors in data words. The the full data transfer rate of 1Mbit/s the total length of the CAN network is limited to less than 50 meters.

Page 13: Computing Machinery Chapter 10: Microcontrollers

Analog-to-Digital (ADC)

Many of the devices and sensors interfaced to a MCU produce varying voltage levels (analog signals) rather than binary vectors (digital signals). For this reason most modern MCU's include built-in analog-to-digital (A/D) conversion circuits. These circuits accept a voltage level on an input line and generate an internal binary encoded value that corresponds to the magnitude of the voltage.

Page 14: Computing Machinery Chapter 10: Microcontrollers

Aliasing

When we choose a sampling rate, we are setting a limit on the maximum frequency (or time rate of change) of the signal that we will be able to measure.

Shown below are two signals of different frequencies. The lower frequency signal is being sampled at a rate of 12 samples per cycle of the signal. If we replace this signal with one with a frequency that is 11 times higher we will be sampling this signal a little more that once per cycle. As shown the sampled voltage levels will match those of the lower frequency signal. This effect is called aliasing.

To prevent aliasing we need to sample at a rate at least twice as high (in samples per second) at the highest frequency signal we want to measure (in cycles/second).

Page 15: Computing Machinery Chapter 10: Microcontrollers

Digital to Analog (D/A)

This is the process of converting a digital (binary encoded) value into an analog voltage level. This operation is much less common on an MCU, but can be implemented using a varying duty-cycle signal and some passive electronics for filtering (see Pulse Width Modulation above). A much better aproach is to use a linear amplifier as a summing circuit, as shown in Figure 10-6. This is an example of a digital to analog (D/A) circuit called an R2R ladder network.

http://www.play-hookey.com/analog/d2a_converter.html

Page 16: Computing Machinery Chapter 10: Microcontrollers

A prescaler is a circuit that divides an incoming clock signal by a predetermined amount. An N level prescaler is sometimes called a divide-by-N counter.

Prescalar

Page 17: Computing Machinery Chapter 10: Microcontrollers

AVR A/D

The AVR MCU includes 8 A/D input circuits. These cicuits can operate in two different modes, either single conversion and free run.

When in single conversion mode, each conversion must be prompted by the running programming.

In free-run mode the A/D conversion is started and will run continuously with updated values being placed in the ADC data register.

Page 18: Computing Machinery Chapter 10: Microcontrollers

BasicX Microcontrollers

The BasicX system is the MCU and the software development environment for a PC-compatible desktop computer running the Microsoft Windows operating system. BASIC programs are written and compiled on the PC and downloaded onto the BasicX MCU through a serial interface to an EEPROM or a parallel USB interface (which needs some additional circuitry).

As with the AVR and PIC18, the BasicX is in-circuit/FLASH programmable. The BX-24 and BX-35 IC's are depicted in Figure 10-22. The BX-35 is also available as a surface mount IC.

BasicX-35 BasicX-24

Page 19: Computing Machinery Chapter 10: Microcontrollers

The BasicX MCU's offer the following features:

25 I/O Lines BX-35 (16 I/O Lines BX-24) - (17 TTL I/O BX-35) (8 TTL I/O BX-24) - 8 Channel Analog-to-Digital Converters (10-bit) or TTL

32 KB EEPROM (external for BX-35) for program and data storage On-chip RAM 400 bytes

Program execution speed 60 microseconds per 16 bit integer add/subtract

Serial I/O speed 2400 baud to 460.8 Kbaud on Com1 300 baud to 19 200 baud on any I/O pin (Com3)

Operating voltage range - 4.0 VDC to 6.0 VDC

I/O internal pull-up resistors 120 kΩ maximum Floating point math On-chip multitasking On-chip clock/calendar Built-in SPI interface Parallel or serial FLASH Programmable

Page 20: Computing Machinery Chapter 10: Microcontrollers
Page 21: Computing Machinery Chapter 10: Microcontrollers
Page 22: Computing Machinery Chapter 10: Microcontrollers
Page 23: Computing Machinery Chapter 10: Microcontrollers
Page 24: Computing Machinery Chapter 10: Microcontrollers
Page 25: Computing Machinery Chapter 10: Microcontrollers
Page 26: Computing Machinery Chapter 10: Microcontrollers
Page 27: Computing Machinery Chapter 10: Microcontrollers
Page 28: Computing Machinery Chapter 10: Microcontrollers
Page 29: Computing Machinery Chapter 10: Microcontrollers
Page 30: Computing Machinery Chapter 10: Microcontrollers
Page 31: Computing Machinery Chapter 10: Microcontrollers
Page 32: Computing Machinery Chapter 10: Microcontrollers
Page 33: Computing Machinery Chapter 10: Microcontrollers
Page 34: Computing Machinery Chapter 10: Microcontrollers
Page 35: Computing Machinery Chapter 10: Microcontrollers
Page 36: Computing Machinery Chapter 10: Microcontrollers
Page 37: Computing Machinery Chapter 10: Microcontrollers
Page 38: Computing Machinery Chapter 10: Microcontrollers
Page 39: Computing Machinery Chapter 10: Microcontrollers
Page 40: Computing Machinery Chapter 10: Microcontrollers
Page 41: Computing Machinery Chapter 10: Microcontrollers
Page 42: Computing Machinery Chapter 10: Microcontrollers
Page 43: Computing Machinery Chapter 10: Microcontrollers
Page 44: Computing Machinery Chapter 10: Microcontrollers
Page 45: Computing Machinery Chapter 10: Microcontrollers
Page 46: Computing Machinery Chapter 10: Microcontrollers
Page 47: Computing Machinery Chapter 10: Microcontrollers
Page 48: Computing Machinery Chapter 10: Microcontrollers
Page 49: Computing Machinery Chapter 10: Microcontrollers
Page 50: Computing Machinery Chapter 10: Microcontrollers
Page 51: Computing Machinery Chapter 10: Microcontrollers