ES C263 Microprocessor Programming and Interfacing Lecture 2 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Last Lecture Evolution of Computers and Microprocessors Moore's Law 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Today's Lecture Instruction Set Architecture Overview of a Microprocessor Design Example 12-01-2011 ES C263 Microprocessor Programming and Interfacing
Processor (8086 through Pentium The Personal Computer Speaker Processor (8086 through Pentium Timer logic (8253) Coprocessor (8087 through 80387 System ROM 640KB DRAM System bus (data, address & control signals) Keyboard logic (8253) DMA Controller (8237) Expansion logic Interrupt logic (8259) Video card Disk controller Serial port Keyboard ... 12-01-2011 ES C263 Microprocessor Programming and Interfacing Extension slots
Instruction Set Architecture (ISA) ISA refers to the actual set of programmer visible instruction set. Serves as a boundary between the hardware and software. Seven dimensions of ISA Class of ISA: general purpose register architectures, where operands are either memory or register locations. 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Memory Addressing: Byte addressing to access memory locations. Addressing Modes: specify the address of register, constant operands and memory objects- - register, immediate, displacement. 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Types and sizes of operands: supports operand sizes of 8 bit, 16 bit, 32 bit. Operations: data transfer, arithmetic, logic, control. Control flow instructions: support conditonal branches, unconditional jumps, procedure calls and returns. Encoding an ISA: fixed length or variable length. 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Memory Overview 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing 12-01-2011 ES C263 Microprocessor Programming and Interfacing
Evolution of programming: machine language 011111110100010101001100010001100000000100000010000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000010000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000010100001000000000000000000000000000000000000000000001101000000000000000000000000000000000000000000001010000000000000001000000000000000000100000000001011100111001101101000011100110111010001110010011101000110000101100010000000000010111001110100011001010111100001110100000000000010111001110010011011110110010001100001011101000110000100000000001011100111001101111001011011010111010001100001011000100000000000101110011100110111010001110010011101000110000101100010000000000010111001110010011001010110110001100001001011100111010001100101011110000111010000000000001011100110001101101111011011010110110101100101011011100111010000000000000000000000000000000000100111011110001110111111100100000001001100000000000000000000000010010000000100100110000000000000000101010000000000000000000000001001001000010010101000000000000001000000000000000000000000000000000000010000000000000000000000001010000000010000000000000000100010010000000100000000000000010000000101010000000000000000000000001001001000010010101000000000000001000000000000000000000000000000000000010000000000000000000000001011000000010000000000000001000010000000000000000000001000000001000000000000000000000000100000011100011111100000000010001000000111101000000000000000000000000000000000000000000000000000010010000110010101101100011011000110111101110111011011110111001001101100011001000010000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000001000000000011111111111100010000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000010000000000111111111111000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000001000000000000000000000000000011010000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000001000100000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000100011000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000001011000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000011010010000000000000000000000000000000000000000000000000000000001001000000100100000000000 late 40’s / early 50’s: programmers coded directly in machine language each machine had its own set of instructions (sequences of 0's & 1's) corresponding to its underlying hardware extremely tedious, error-prone 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing -Fetches Instruction -Executes Instruction 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Computer Hardware Organization Example: 3 Instructions of a program Input Value from port 05 Add 7 to this value Output the result to port 02 Control unit common bus Arithmetic logic unit memory output input Registers program data unit unit storage storage 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Add Bus CPU Data Bus Control signals 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Memory Add Bus Data Bus Read Write Memory – Registers to hold bits 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Ex : 8 Registers 4 bits Add lines : 3 (Unidirectional) Data lines : 4 (Bidirectional) 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Design Example 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Design a microprocessor based system to control pH of a solution in a reactor tank. User enters desired pH (0-14) and controller gain Reactor tank provided with three pH sensors, to compute the average pH. Reactor tank has three inputs. (acid, base flow controlled by valves, effluent discharged from factory) 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Valve Control Controlled by stepper motors 1 step is by 1.8 degrees rotation Valve opening = kP * error Where error = desired pH – measured pH. Error positive- close fully acid valve and open base valve accordingly Error negative- close fully base valve and open acid valve accordingly. 0 – 360 degrees correspond to 0 to 200 steps. 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Parallel I/O Serial I/O Memory I/O Interface CPU Data Address Control 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Stepper Motor sequence: A B C D 1 0 1 0 0 1 1 0 0 1 0 1 1 0 0 1 ACW CW Use a 4- bit port + driver (nearly 1 A current) 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing pH sensor Vout pH 7 14 Voltage output 60mV/pH -420mV - +420mV 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Interfacing Analog to Digital Converter 8-bit ADC I0 I7 D0 D7 Start A B C EOC OE ALE ADC 0809 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Input Keys Numeric keys 0 – 9 Function keys pH, kP, enter Matrix Keypad interfacing!! - 2 four bit ports. 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Two digit Display Two seven segment display devices to display pH Memory Interfacing ROM (4K) - FF000H – FFFFFH SRAM (4K) - 00000H – 00FFFH 12-01-2011 ES C263 Microprocessor Programming and Interfacing
ES C263 Microprocessor Programming and Interfacing Method of Approach Identify input and output devices Memory requirements Suitable memory and I/O interfacing ALP Assumptions made 12-01-2011 ES C263 Microprocessor Programming and Interfacing