Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computing Machinery Chapter 10: Microcontrollers.

Similar presentations


Presentation on theme: "Computing Machinery Chapter 10: Microcontrollers."— Presentation transcript:

1 Computing Machinery Chapter 10: Microcontrollers

2 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 I 2 C and CAN bus communications and video controllers. Microcontroller

3 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.

4 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

5 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.

6 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).

7 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.

8 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.

9 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)

10 Basic-X35 Schematic AT25256

11 The Inter-Integrated Circuit (I 2 C) 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 I 2 C uses bidirectional data and clock lines with open-collector logic. The standard data rate for the I 2 C is 100 kilobits/second. It also support a low-speed 10 Kbits/s or lower. The I 2 C 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 I 2 C 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. I 2 C Communications

12 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.

13 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.

14 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).

15 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 This is an example of a digital to analog (D/A) circuit called an R2R ladder network.

16 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

17 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.

18 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 The BX-35 is also available as a surface mount IC. BasicX-35 BasicX-24

19 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 Kbaud on Com1 300 baud to baud on any I/O pin (Com3) Operating voltage range 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

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51


Download ppt "Computing Machinery Chapter 10: Microcontrollers."

Similar presentations


Ads by Google