Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microprocessors Typical microprocessor controlled devices: Camera, mobile phone, stereo, mp3 player, electronic toys… High-level microprocessor controlled.

Similar presentations


Presentation on theme: "Microprocessors Typical microprocessor controlled devices: Camera, mobile phone, stereo, mp3 player, electronic toys… High-level microprocessor controlled."— Presentation transcript:

1 Microprocessors Typical microprocessor controlled devices: Camera, mobile phone, stereo, mp3 player, electronic toys… High-level microprocessor controlled automation: DHL and FedEx, Park and Shop, … What are the similarities ? Both types use computer control What is the difference? Real-time programmable

2 Basic Architecture of a microprocessor A simplified computer

3 CPU: Central Processing Unit (i) Break [complex] task  sequence of [very simple] sub-tasks each sub-task: dedicated circuit inside the CPU (ii) Perform each sub-task sequentially, in T units of time (or less) until all sub-tasks have been done

4 CPU structure The Accumulator: main register of the ALU Each ALU operation: operand (data value)  accumulator operand  memory output  accumulator. The instruction register holds the binary code of the instruction that is being executed. The program counter contains the address of the memory location from which the next instruction code will be taken.

5 Microprocessors: Control unit The control unit controller-sequencer and instruction decoder

6 Microprocessor memory Memory: Microprocessor memory: on chip [WHY?] Other memory terms: - ROM - PROM (programmable ROM): - EPROM (erasable PROM: erased/reprogrammed by UV-light) - RAM

7 Microprocessor: Input and Output I/O chips are connect the microprocessor to a variety of devices. EXAMPLES: memory disks, printers, data-links to other computers, instrumentation controlling equipment, etc. Common of I/O chips: Parallel Input/Output (PIO) Serial I/O (UART, Universal Asynchronous Receiver/Transmitter)

8 Microprocessor: Machine language [in decimal: ] [in decimal: ] OPCODE OPERANDS Line 1. Operation-code 35 (load some data into a register): Look at the number stored in register 3 Go to the memory location = [value of register 3] + 68 Get the data from that cell Store it into register 8. Line 2. Operation code 0 (add two numbers). Add the contents of register 1 and register 8 store answer into register 6.

9 Microprocessor: Assembly language Machine language: Difficult to write programs! Assembly language: English codes for each opcode and operand  Easier to program  Need a way to convert Assembly language  machine language

10 Microprocessor: Assembly language [label]opcode [operands][comment] CSEGAT 0000H LOOP:SETBP2.7; turn off the LED LOOP1:JNBP0.7,LIGHT AJMPLOOP LIGHT:CLRP2.7; turn on the LED AJMPLOOP1 END

11 Microprocessor: Assembly language [label]opcode [operands][comment] CSEGAT 0000H LOOP:SETBP2.7; turn off the LED LOOP1:JNBP0.7,LIGHT AJMPLOOP LIGHT:CLRP2.7; turn on the LED AJMPLOOP1 END Run the program from memory location (Hexadecimal) 0000)

12 Microprocessor: Assembly language [label]opcode [operands][comment] CSEGAT 0000H LOOP:SETBP2.7; turn off the LED LOOP1:JNBP0.7,LIGHT AJMPLOOP LIGHT:CLRP2.7; turn on the LED AJMPLOOP1 END token (marks the line with a name) set bit: set the value of a bit = 1 which bit: port 2.7 (pin #7 of outputs)

13 Microprocessor: Assembly language [label]opcode [operands][comment] CSEGAT 0000H LOOP:SETBP2.7; turn off the LED LOOP1:JNBP0.7, LIGHT AJMPLOOP LIGHT:CLRP2.7; turn on the LED AJMPLOOP1 END token (marks the line with a name) JUMP if NOT: if the bit is not set, i.e. = 0. which bit: port 0.7 (pin #7 of inputs)

14 Microprocessor: Assembly language [label]opcode [operands][comment] CSEGAT 0000H LOOP:SETBP2.7; turn off the LED LOOP1:JNBP0.7,LIGHT AJMPLOOP LIGHT:CLRP2.7; turn on the LED AJMPLOOP1 END automatic jump (unconditional jump) where? to program counter located by LOOP

15 Microprocessor: Assembly language [label]opcode [operands][comment] CSEGAT 0000H LOOP:SETBP2.7; turn off the LED LOOP1:JNBP0.7, LIGHT AJMPLOOP LIGHT:CLRP2.7; turn on the LED AJMPLOOP1 END token (marks the line with a name) CLEAR: set bit = 0. which bit: port 2.7 (pin #7 of outputs)

16 Microprocessor: Assembly language [label]opcode [operands][comment] CSEGAT 0000H LOOP:SETBP2.7; turn off the LED LOOP1:JNBP0.7,LIGHT AJMPLOOP LIGHT:CLRP2.7; turn on the LED AJMPLOOP1 END automatic jump (unconditional jump) where? to program counter located by LOOP1

17 Microprocessor: Assembly language [label]opcode [operands][comment] CSEGAT 0000H LOOP:SETBP2.7; turn off the LED LOOP1:JNBP0.7, LIGHT AJMPLOOP LIGHT:CLRP2.7; turn on the LED AJMPLOOP1 END terminate program (erase it from RAM) Question: When will it END ?

18 Microprocessor: Assemblers Assembly programming software What’s happening here ?

19 Burning a PROM

20 Hardwired Microprocessor control CSEGAT 0000H LOOP:SETBP2.7; turn off the LED LOOP1:JNBP0.7,LIGHT AJMPLOOP LIGHT:CLRP2.7; turn on the LED AJMPLOOP1 END

21 How about Computer control ? Need a special board that can communicate with processor plug it here Need a program that can communicate with the board: (device driver) Connect output sockets on this board to outside actuators/sensors

22 How about Computer control ?? Need a program that can communicate with the board: (device driver) How to use the device driver ? If device driver is written in C++: Write your program in C++ Link your program to device driver (library) Your program  device driver

23 Computer basics Operating System Examples: What does it do ? Compiler(s) Examples: What do they do ? Application programs Examples: What do they do?


Download ppt "Microprocessors Typical microprocessor controlled devices: Camera, mobile phone, stereo, mp3 player, electronic toys… High-level microprocessor controlled."

Similar presentations


Ads by Google