Week 2 - Number Systems and 8085 Microprocessoors PDF

Document Details

ElegantIron6471

Uploaded by ElegantIron6471

Alanya Alaaddin Keykubat Üniversitesi

Hasan Pişkin

Tags

number systems binary hexadecimal microprocessor

Summary

This document provides a summary for Week 2 of Number Systems and 8085 microprocessors at Alanya University. It details the decimal, binary, and hexadecimal number systems. It also covers the 8085 microprocessor.

Full Transcript

Number System Hasan Pişkin Alanya University – CSE305 [email protected] Learning Goals Different number systems Decimal vs. Binary Number system Significance of Binary Digits...

Number System Hasan Pişkin Alanya University – CSE305 [email protected] Learning Goals Different number systems Decimal vs. Binary Number system Significance of Binary Digits Hexadecimal Number System Decimal vs. Binary vs. Hexadecimal Number systems Representation of Binary in Hexadecimal Conversion amoung Hexadecimal, Decimal and Binary systems Different Number Systems Decimal: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Base 10 10 symbols Binary: 0, 1 Base 2 2 symbols Hexadecimal: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Base 16 16 symbols We use these number systems to represent different systems Decimal Representation of numbers Decimal: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 U TU TU TU HTU 100 101100 101100 101100 102101100 0 10 20 90 100 0 10 20 90 100 1 11 21 91 101 1 11 21 91 101 2 12 22 92 102 2 12 22 92 102 3 13 23 93 103 3 13 23 93 103 4 14 24 94 104 4 14 24 94 104 … … … 5 15 25 95 105 5 15 25 95 105 6 16 26 96 106 6 16 26 96 106 7 17 27 97 107 7 17 27 97 107 8 18 28 98 108 8 18 28 98 108 9 19 29 99 109 9 19 29 99 109 U: unit’s place T: Ten’s place H: Hundered’s place Binary Representation of numbers Binary: 0, 1 4 bits representation: Decimal: Binary: 23222120 0 0 0000 1 1 0001 2 10 0010 3 11 0011 4 100 0100 5 101 0101 6 110 0110 7 111 0111 8 1000 1000 9 1001 1001 Binary Representation of Signals Significance of bits 1 0 On / OFF button +5 V 1 +2 V +0.8 V 0 0V Hexadecimal Number System Hexadecimal: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Base 16 160 161160 161160 161160 161160 161160 162161160 0 10 90 A0 B0 F0 100 1 11 91 A1 B1 F1 101 2 12 92 A2 B2 F2 102 3 13 93 A3 B3 F3 103 4 14 94 A4 B4 F4 104 5 15 95 A5 B5 F5 105 6 16 … 96 A6 B6 … F6 106 … 7 17 97 A7 B7 F7 107 8 18 98 A8 B8 F8 108 9 19 99 A9 B9 F9 109 A 1A 9A AA BA FA 10A B 1B 9B AB BB FB 10B C 1C 9C AC BC FC 10C D 1D 9D AD BD FD 10D E 1E 9E AE BE FE 10E F 1F 9F AF BF FF 10F Why we need hexadecimal number system? Decimal: Binary: Hexadecimal: 0 0 0 1 1 1 0/1 : 1 bit 2 10 2 3 11 3 4 bits : 1 nibble 4 100 4 5 101 5 8 bits : 1 Byte 6 110 6 7 111 7 1024 Byte : 1 KB 8 1000 8 1024 KB : 1 MB 9 1001 9 10 1010 A 1024 MB : 1 GB 11 1011 B 12 1100 C 1024 GB : 1 TB 13 1101 D 1024 TB : 1 PB 14 1110 E 15 1111 F We need Hexadecimal number system to complete binary sequence Representation of Binary in Hexadecimal Every Hexadecimal Number can be represented by 4 bits (nibble) of Binary numbers Binary: Hexadecimal: 16 bits system in binary 0000 0 0001 1 (1010110101100101) 2 0010 2 0011 3 Group by 4 bits 0100 4 0101 5 0110 6 1010 1101 0110 0101 0111 7 1000 8 1001 9 A D 6 5 1010 A 1011 B 1100 C (AD65)16 1101 D 1110 E Add prefix as 0x 1111 F 0xAD65 Instead of using 16 numbers, we can use 4 hexadecimal to represent it in a short way Binary to Decimal Conversion 4 bits example (𝟎𝟏𝟏𝟎)2 = 𝟎 × 𝟐𝟑 + 𝟏 × 𝟐𝟐 + 𝟏 × 𝟐𝟏 + 𝟎 × 𝟐𝟎 =𝟎+𝟒+𝟐+𝟎 =𝟔 in decimal 8 bits example (𝟏𝟎𝟏𝟎𝟎𝟏𝟏𝟎)2 = 𝟏 × 𝟐𝟕 + 𝟎 × 𝟐𝟔 + 𝟏 × 𝟐𝟓 + 𝟎 × 𝟐𝟒 + 𝟎 × 𝟐𝟑 + 𝟏 × 𝟐𝟐 + 𝟏 × 𝟐𝟏 + 𝟎 × 𝟐𝟎 = 𝟏𝟐𝟖 + 𝟎 + 𝟑𝟐 + 𝟎 + 𝟎 + 𝟒 + 𝟐 + 𝟎 = 𝟏𝟔𝟔 in decimal Hexadecimal to Decimal Conversion (𝟎𝟏𝟏𝟎)16 = 𝟎 × 𝟏𝟔𝟑 + 𝟏 × 𝟏𝟔𝟐 + 𝟏 × 𝟏𝟔𝟏 + 𝟎 × 𝟏𝟔𝟎 = 𝟎 + 𝟐𝟓𝟔 + 𝟏𝟔 + 𝟎 = 𝟐𝟕𝟐 in decimal (𝑨𝑩𝑪)16 = 𝐴 × 𝟏𝟔𝟐 + 𝐵 × 𝟏𝟔𝟏 + 𝐶 × 𝟏𝟔𝟎 = 10× 𝟏𝟔𝟐 + 11 × 𝟏𝟔𝟏 + 12 × 𝟏𝟔𝟎 = 𝟐𝟓𝟔𝟎 + 𝟏𝟕𝟔 + 𝟏𝟐 = 𝟐𝟕𝟒𝟖 in decimal Decimal to Binary Conversion (𝟐𝟓)10 = (? )2 2 25 1 2 12 𝟏 0 2 6 𝟎 0 (𝟏𝟏𝟎𝟎𝟏)2 1 2 3 𝟎 1 2 1 𝟏 0 𝟏 16 8 4 2 1 25 1 1 0 0 1 Decimal to Hexadecimal Conversion (𝟐𝟓)10 = (? )16 16 × 1 = 16 16 25 25 − 16 = 9 9 16 1 𝟗 (𝟏𝟗)16 1 16 × 0 = 16 𝟎 𝟏 1−0=1 161 160 25 1 9 Addition in Binary Number System Addition in Decimal: 4 7 27 786 + 5 + 3 + 5 + 535 9 10 32 1321 Addition in Binary: 0 1 0 1 1011 + 0 + 0 + 1 + 1 + 1010 0 1 1 10 10101 101111 + 101101 1011100 Addition in Hexadecimal Number System Decimal: Hexadecimal: 0 0 1 1 2 2 7 89 3 3 + 5 56 4 4 CD F 5 5 6 6 7 7 8 8 F 15 9 9 + F 15 10 A 11 B 1E 30 12 C 13 D 14 E 16 30 15 F 16 1 14 E 𝟎 1 1 Addition in Hexadecimal Number System Decimal: Hexadecimal: 163 162 161 160 0 0 0 0 1 E 1 1 16 + 𝑥 = 30 2 2 𝑥 = 14 E 3 3 4 4 5 5 8 99 16 + 𝑥 = 18 6 6 + 1 89 𝑥=2 7 7 A 22 8 8 9 9 10 A DA F 16 + 𝑥 = 30 11 B + BA F 𝑥 = 14 E 12 C 13 D 1 95 E 16 + 𝑥 = 21 14 E 15 F 𝑥=5 5 16 + 𝑥 = 25 𝑥=9 9 Subtraction in Binary Number System Subtraction in Decimal: 9 22 27 - 5 - 8 - 15 4 14 12 Subtraction in Binary: 1 0 0 1 0 10 0 1 0 1 10 1 - 0 0 1 0 - 0 0 1 0 - 0 0 1 0 0 1 1 1 0 1 1 1 0 1 1 1 Remember in binary 1+1 = 10 1 = 10 -1 Subtraction in Binary Number System Decimal: Binary: 0 0000 8 4 2 1 1 0001 2 0010 1 0 0 1 9 3 0011 - 0 0 1 0 2 4 0100 5 0101 6 0110 0 1 1 1 7 7 0111 8 1000 9 1001 16 8 4 2 1 1 1 1 1 15 1 0 0 1 1 19 - 1 0 1 0 10 - 0 0 1 1 0 6 0 1 0 1 5 0 1 1 0 1 13 Subtraction in Hexadecimal Number System FA B Decimal: Hexadecimal: - A EF 0 0 ? 1 1 2 2 3 3 4 4 F 9 1B 5 5 - A E F 6 6 4 B C 7 7 8 8 9 9 E =14 1B =27 19 =25 - F =15 10 A - A =10 - E =14 11 B 4= 4 C =12 12 C B =11 13 D 14 E 15 F Subtraction in Hexadecimal Number System Decimal: Hexadecimal: 0 0 7 78 8 1 1 - 0 DE F 2 2 6 99 9 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 A 11 B 12 C 13 D 14 E 15 F Number System Hasan Pişkin Alanya University – CSE305 [email protected] Introduction to 8085 microprocessors Hasan Pişkin Alanya University – CSE305 [email protected] Learning Goals Word Length of microprocessors Pin Diagram of 8085 microprocessors Typical Structure of Microprocessor units Word Length of microprocessors 1971: Intel 4000 Family 4001: 256 – Byte ROM 4002: 40- Byte RAM 4003: 10-bit I/O Shift Register 4004: 4-bit μP Unsigned Representation 4004: 8 4 2 1 4-bit addition 0 0 0 0 0 0 0 0 1 1 8 4 2 1 0 0 1 0 2 1001 9 0 0 1 1 3 0 1 0 0 4 + 0101 5 1110 14 1 1 1 1 15 Word Length of microprocessors – Unsigned Rep. Word length: 0 24 − 1 It can perform unsigned addition of 4 – bit numbers 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Range 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 8 4 2 1 1000 8 + 1001 9 10001 This processor can not apply this addition 17 Word Length of microprocessors – Signed Rep. Word length: −2(4−1) 2(4−1) − 1 It can perform signed addition of 4 – bit numbers 0 1 2 3 4 5 6 7 -8 -7 -6 -5 -4 -3 -2 -1 Range 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Word Length of microprocessors – Unsigned Rep. Unsigned representation 0 2(4−1) − 1 1971: Intel 4004 4-bit μP signed representation −2(4−1) 2(4−1) − 1 1972: Intel 8008 8-bit μP 1974: Intel 8080 8-bit μP 1977: Intel 8085 8-bit μP Unsigned representation 0 2(8−1) − 1 signed representation −2(8−1) 2(8−1) − 1 Pin Diagram Of 8085 μP 40 – pin DIP IC (DIP: Dual Inline Package, IC: Integrated Circuit ) VCC / VSS Vcc: (Pin.No.40) a) It is a type of the Main Input Power-Supply pin which supplies the External DC Voltage of +5v (i.e 17mA) for the operation of the 8085 Microprocessor. b) This External DC Voltage of +5v (i.e 17mA) from the Vcc pin is with a Tolerance-Level of 5% & the Maximum Power-Dissipation of 1.5w is connected to this pin only. VSS and VCC: ( Pin.No.20 ) a) It is a type of the Main Output Power-Ground pin which is connected to ground of the VCC pin for avoiding ground-interference. b) Here, thus it is connected to ground, it not only avoids the ground-interference but it helps the VCC pin to supply the +5v DC of duty-power to the 8085 IC by balancing it voltage and protecting it to get damaged. Frequency input X1 & X2: ( Pin.No.1 & 2 ) a) These are the 2 clock-input signals which are connected across a crystal RC\LC Circuit of 6MHz Frequency. b) Whenever the microprocessor requires a clock-frequency of 3MHz, these 2 clock-input pins divides the crystal-frequency into 2 parts in the internal circuitry. c) Thus, the 1st 3MHz of frequency is supplied to the microprocessor, while the 2nd 3MHz of Frequency is used as an operating frequency to synchronize the operations of 8085 Microprocessor. d) Here to set the frequency of internal clock generator, X1 can also be an external clock input instead of the First-Input Frequency Signal. Reset Out/In RESET OUT / IN: ( Pin.No.3 and 36) a) RESET OUT is an Active-High Output System-Reset Indicator-Signal synchronized to the Processor-Clock of Microprocessor & used as an Acknowledgement-Signal to which passes a Low-Sate Signal to RESET − IN in order to Reset the Whole Internal Structure present in the 8085 Microprocessor along with the Connected-Devices to its Original Initial State. b) When the 8085 Microprocessor gets the Acknowledgement-Signal from the RESET-OUT to the Reset- Signal RESET − IN for the Operation of System-Reset, the Output of the RESET-OUT goes to High-State & Remains to the High-State as long as the RESET − IN is kept to Low-Sate. c) Thus, this after receiving the Acknowledgement-Signal from the RESET-OUT, the Reset-Signal RESET − IN resets the HLDA Flip-Flops, the Interrupts Enabled & the Program-Counter to its Original Initial State (i.e 0) & sets the Address & Data Bus along with the Control-Lines Tri-Stated by clearing the entire operands/op-code present temporary in the Memory of Flag-Register & Temporary-Register & then it sends an Acknowledgement-Signal to the RESET-OUT to indicate that the complete 8085 Microprocessor along with the Connected-Devices has been Resetted to its Original Initial State. d) Thus, to indicate that the complete 8085 Microprocessor along with the Connected-Devices has been Resetted to its Original Initial State, the RESET − IN is goes to High-State & this RESET-OUT goes to Low- State to lasts an Integral-Number of Clock-Periods which is sent to the Processor-Clock of 8085 Microprocessor (i.e CLK) for Synchronization with the Present-Status of the 8085 Microprocessor. SOD / SID SOD/SID (Serial Output/Input Data): ( Pin.No.4 and 5 ) a) It is an Active-High Serial Output Data Line used for Serial Data Communication. b) Generally, it is a 1-Bit Output Port inside the 8085 Microprocessor that is used to write 1-Bit Data to / from the Peripheral-Devices. TRAP TRAP (RST 4.5): ( Pin.No.6 ) a) It is an Active, Non-Maskable , Vectored Hardware Interrupt which is generally used to enable the 2-Clock Input Pins i.e X1 & X2 by an INTE-FF( i.e Interrupt-Enable Flip- Flop) to indicate the 8085 Microprocessor that the input-power is been received through the Vcc Pin. b) Since this interrupt has the Highest-Priority among all the Interrupts of the 8085 Microprocessor, it is also used for Some Catastrophic-Events such as Power- Failure/Immediate Emergency Shutoff & Partly-Errors. Interrupt Pins RST 7.5: ( Pin.No.7 ) : 2nd Priority RST 6.5: ( Pin.No.8 ): 3rd Priority RST 5.5: ( Pin.No.9 ): 4th.. INTR: ( Pin.No.10): 5th.. a) They are Active High Maskable Vectored-Hardware Interrupts which are implemented by a multi-purpose Instructions. b) According to the Priority after TRAP pin, these pins can be enabled by SYSTEM or Processor RESET or after Re-Organization of Interrupts. Interrupt Pins 𝐈𝐍𝐓𝐀 ( Pin.No.11 ) It is an Active-Low, General-Purpose Interrupt-Acknowledgement Signal which indicates that the processor has acknowledged the Externally Connected Peripheral Devices that it has recognized the Interrupt-Signal by an INTR pin & needs the Operation-Code to proceed further. DATA BUS AD0-AD7: ( Pin.No.12 to Pin.No.19 ) a) Used for receiving the program code from memory b) Used for receiving data Byte from an input port or memory c) Used for sending out a data Byte to an output port or to memory WR and RD WR: stands for write WR and RD (Pin 31 and 32) RD: stands for read WR RD 0 1 𝐴𝐷7−0 are output pins 1 0 𝐴𝐷7−0 are input pins 1 1 Internal Processing 0 0 μP has malfunctined! Address Bus and Address Latch Enable (ALE) A8-A15: ( Pin.No.21 to Pin.No.28 ) 1 bit 0 and 1 21 locations 2 bits 0 0,01,10, 11 22 locations 8 bits 00000000,… 28 locations 16 bits 0000000000000000, … 216 locations (64K locations) 𝑨𝟏𝟓 to 𝑨𝟖 and 𝑨𝑫𝟕 to 𝑨𝑫𝟎 216 locations (64K locations) Higher order Byte Lower order Byte ALE= 0, LOW, DATA BUS Address Latch Enable (ALE = 1 , High) Address latch IO/M with WR and RD ഥ (Pin no: 34) IO/ M ഥ IO/ M WR RD 0 0 1 μP writes to Memory 0 1 0 μP reads from Memory 1 0 1 μP writes to Output port 1 1 0 μP reads from Output port IO/M with S0 and S1 𝑺𝟎 and 𝑺𝟏 (Pin no: 29 and 33) ഥ IO/ 𝐌 𝑺𝟎 𝑺𝟏 Machine Cycle 0 1 1 Opcode Fetch (OP) 0 1 0 Memory Read (MR) 0 0 1 Memory Write (MW) 1 1 0 I/O Read (IOR) 1 0 1 I/O Write (IOW) 1 1 0 Interrupt Aknowledge (INA) READY, HLDA, HOLD, CLK READY (Pin no: 29 and 33) Indicates wheather an I/O device is ready to send / receive data READY = 1 (High), I/O μP is ready READY = 0 (Low), μP is waiting HOLD External device requests Bus access HLDA Acknowledges the hold request of a device CLK Syncronization clock between devices to send/receive data between μP and I/O device 8085 Microprocessor Typical Structure of μP unit I/O Registers System BUS Interface Arithmetic & Logic unit Timing & Control unit Memory Introduction to 8085 microprocessors Hasan Pişkin Alanya University – CSE305 [email protected]

Use Quizgecko on...
Browser
Browser