Presentation is loading. Please wait.

Presentation is loading. Please wait.

15: Microprocessor and microcontroller

Similar presentations


Presentation on theme: "15: Microprocessor and microcontroller"— Presentation transcript:

1 15: Microprocessor and microcontroller
Lecture 14

2 15.1: Control µprocessor systems – use as control system and are term as embedded microprocessor Dedicated to controlling a specific function Self-started, self-contained with own operating program Requiring no human intervention

3 15.2: Microprocessor systems
Have 3 parts: Central processing unit (CPU) – recognise and carry out program instruction Input/output interface – handle communication between computer and outside world Memory – to hold program instructions and data µprocessor with memory and various input/output arrangement all on the same chip - microcontroller

4 15.2.1: Busses Digital signals move from one section to one another along paths called buses Data bus – data associated with processing function of CPU Address bus – indicate where data to be found, selection of memory or input/output ports Control bus – carry out signals related to control actions i.e. READ, WRITE

5 General form of microprocessor system

6 15.2.2: General architecture of µp
Arithmetic and logic unit (ALU) – to perform data manipulation Register – temporarily hold internal data that CPU is currently used Control unit – determine timing and sequence of operations

7 General internal architecture of microprocessor system

8 Registers – temporary storage
Accumulator – data for i/p to ALU Status register – flags, indicate status of latest operation Program counter (PC) or instruction pointer (IP) – keep track position of instruction in a program Memory address – address of data Instruction register (IR) – store instruction General purpose register – temporary storage for data or address Stack pointer register (SP) – form address which defines top of stack in RAM

9 15.2.3: Memory Memory unit – stores binary data and takes the form of one or more integrated circuits ROM – read only memory, fixed program i.e. operating system PROM – programmable ROM, used for ROM chip that can be programmed by user EPROM – erasable and programmable ROM, EEPROM – electrical and erasable PROM, erasure b high voltage RAM – random access memory, temporary data Programs stored in ROM – firmware, RAM used program storage - software

10 15.3: Microcontroller Integration of a microprocessor and input/output interfaces and other peripherals such as timers, on a single chip Has pins for external connections –i/o, power, clock, control signals i/o ports – single port 8-bit word or two ports 16-bit word

11 Block diagram of a microcontroller

12 Micro Small, Compact Controller Read inputs Process Produce output

13 Applications of Microcontroller
Electronic gadget Mobile phone Toys Robotics Radio DVD player etc

14 There are a lot of different microcontrollers available in the market
There are a lot of different microcontrollers available in the market. For example, Atmel, Motorola, Intel and PIC. Each one has its own advantages and disadvantages. There are a lot of similarities between the microcontrollers. Emphasis on PIC16F877A.

15 15.3.3: Microchip microcontroller
PIC microcontroller – Peripheral Interface Controller E.g. PIC16AXX, PIC16FXX, Harvard architecture – instruction are fetched from program memory using busses that are distinct

16 Harvard architecture

17 PIC16C74A

18 Why PIC? Easy to buy, inexpensive, low cost development tools and powerful. You can get from Farnell, RS and Hitectron. You can even get free sample from Microchip website. The development software is distributed as freeware (MPLAP, PCCLITE and ICPROG). One basic microcontroller system cost less than RM 50.

19 CORE PIC FAMILY PICs come with 1 of 4 CPU ‘cores’:
12bit cores with 33 instructions: 12C50x, 16C5x 14bit cores with 35 instructions: 12C67x,16Cxxx,16Fxxx 16bit cores with 58 instructions: 17C4x,17C7xx ‘Enhanced’ 16bit cores with 77 instructions: 18Cxxx, 18Fxxx

20 PACKAGING PIC FAMILY PICs come in a huge variety of packages:
8 pin DIPs, SOICs: 12C50x (12bit) and 12C67x (14bit) 18pin DIPs, SOICs: 16C5X (12bit), 16Cxxx (14bit), 16Fxxx (14bit) 28pin DIPs, SOICs: 16C5X (12bit), 16Cxxx (14bit), 16Fxxx (14bit) 40pin DIPs, SOICs: 16Cxxx (14bit), 17C4x (16bit) pin PLCCs*: 16Cxxx (14bit), 17C4x / 17Cxxx (16bit)

21 SPEED PIC FAMILY PICs require a clock to work.
Can use crystals, clock oscillators, or even an RC circuit. Some PICs have a built in 4MHz RC clock. Not very accurate, but requires no external components! Instruction speed = 1/4 clock speed (Tcyc = 4 * Tclk) All PICs can be run from DC to their maximum spec’d speed: 12C50x 4MHz 12C67x 10MHz 16Cxxx, 16Fxxx 20MHz 17C4x / 17C7xxx 33MHz 18Cxxx, 18Fxxx 40MHz

22 MEMORY PIC FAMILY PIC program space is different for each chip.
Some examples are: 12C bit instructions 16C71C 1024 (1k) 14bit instructions 16F84A 1024 (1k) 14bit instructions 16F (8k) 14bit instructions 17C (16k) 16bit instructions

23 PROGRAM MEMORY PIC FAMILY
PICs have two different types of program storage: 1. EPROM (Erasable Programmable Read Only Memory) Needs high voltage from a programmer to program (~13V) Needs windowed chips and UV light to erase Note: One Time Programmable (OTP) chips are EPROM chips, but with no window! PIC Examples: Any ‘C’ part: 12C50x, 17C7xx, etc. 2. FLASH Re-writable (even by chip itself) Much faster to develop on! Finite number of writes (~100k Writes) PIC Examples: Any ‘F’ part: 16F84, 16F87x, 18Fxxx (future)

24 DIGITAL I/O PORT PIC FAMILY
All PICs have digital I/O pins, called ‘Ports’ the 8pin 12C508 has 1 Port with 4 digital I/O pins the 18pin 16F84A has 2 Ports with 13 digital I/O pins the 40pin 16F877A has 5 Ports with 33 digital I/O pins the 68pin 17C766 has 9 Ports with 66 digital I/O pins Ports have 2 control registers TRISx sets whether each pin is an input or output PORTx sets their output bit levels Most pins have 25mA source/sink (directly drives LEDs)

25

26

27 15.4.2: Application- Domestic washing machine
A. Inputs water temperature, motor speed – ADC Water level switch – Port A B. Outputs Hot/cold water valve Water pump control Door lock Buzzer Motor direction Heater control

28 15.4.2: Application- Domestic washing machine (cont.)
C. Outputs Displays Inputs from keyboards D. Others PWM – provide signal to motor Interrupt – stopped if interrupt i.e. door opened

29 Domestic washing machine

30 15.5: Programming steps Define problem – function to perform, i/o required, constraints – speed, accuracy, memory size, etc. Define algorithm – sequence of steps Flowchart and pseudo code –steps and program flow Translate flow chart/algorithm into instruction using language – assembly, C Test and debug program

31 Flow chart symbols

32 Flow chart

33 Sequence

34 WHILE-DO

35 IF-THEN-ELSE

36 End of Lecture 14


Download ppt "15: Microprocessor and microcontroller"

Similar presentations


Ads by Google