Microcomputer Systems
Microcomputer Systems
Outline:
• Components of microcomputer system
• Executing an instruction
• I/O devices
• Programming languages
• Bit Position
• The positions are numbered from right to left starting with 0
• Low byte comes from memory byte with lower address and high byte comes from memory
byte with higher address
• Operations
• Processor can perform two operations on memory: read(fetch) and write(store)
• In read processor gets a copy of data and the contents of that location is unchanged
whereas in write the data becomes the new content of the location
• Suppose a processor uses 20 bits for an address. How many memory bytes can be accessed?
• The number of memory bytes will be 220=1,048,576=1 MB
CPU:
• It controls computer by executing programs stored in the memory
• The instructions performed by a CPU is known as instruction set
• Instruction set for each CPU is unique
• 8086 microprocessor has two main components: Execution Unit and Bus Interface Unit
• EU and BIU is connected by an internal bus
• When EU is executing an instruction the BIU fetches up to six bytes of the next instruction and
places them in the instruction ` known as instruction prefetch
• Execution Unit
• Used to execute instructions
• Contains a circuit called Arithmetic and Logic Unit(ALU)
• The data for the operations are stored in circuits called registers
• Eight registers for storing data: AX, BX, CX, DX, SI, DI, BP and SP
• It also contains FLAGS register whose individual bits reflect the result of a computation
• Bus Interface Unit
• Facilitates communication between the EU and the memory or I/O circuits
• Transmits addresses, data and control signals on the buses
• Registers are CS, DS, ES, SS and IP holding address of memory locations
• IP contains the address of the next instruction to be executed by the EU
I/O Ports:
• I/O devices are connected to the computer through I/O circuits
• Each of these circuits contains several registers known as I/O ports
• I/O ports have addresses and connected to the bus system
• These addresses are known as I/O addresses and can only be used in input or output instructions
• Data to be input from an I/O device are sent to a port where they can be read by the CPU
• On output CPU writes data to an I/O port
• Two types of I/O ports: Serial and Parallel
• Serial port
• Transfers one bit at a time
• Used for slower transfer such as keyboard.
• Parallel port
• Transfers 8 or 16 bits at a time
• Requires more wiring connections
• Used for faster data transfer such as disk drives.
I/O Devices:
• Magnetic Disk
• Magnetic disks are used for permanent storage of programs and data.
• The device that reads and writes data on a disk is called disk drive.
• Floppy Disk:
• Light weight and portable
• Easy to put away for safekeeping and use it on different computers.
• Amount of data depends on type, ranging from 360KB-1.44MB (1KB).
• Hard Disk:
• Enclosed in a hermetically sealed container that is non removable from computer
called a fixed disk.
• Can store more data than floppy disk. Typically 20, 40 to over 100MB.
• A program can access information in a hard disk much faster than a floppy disk.
• Keyboard
• Allows the user to enter information in a computer.
• It has keys of typewriters and a number of control and function keys.
• Has own microprocessor that sends coded signal to computer when a key is pressed or
released.
• No direct contact between keyboard and display.
• Display Monitor
• Standard output device of the computer.
• Displayed information on the screen is generated by video adapter.
• Most adapters can generate both text characters and graphics images. Some even display in
color.
• Printers
• Printers are slower than monitors but provide more permanent output.
• Printer outputs are known as hardcopies.
• Daisey wheel:
• The output is similar to that of a typewriter.
• Dot matrix:
• Prints characters composed of dots.
• Some can generate near-letter-quality printing.
• Print characters with different fonts as well as graphics.
• Laser printers:
• Print characters composed of dots.
• The resolution is high (300 dots per inch)
• It is expensive
Instruction Execution:
• Machine instructions have two parts: an Opcode and Operands
• Opcode field which stands for operation code and it specifies the particular operation that is to be
performed. Each operation has its unique opcode.
• Operands fields which specify where to get the source and destination operands for the operation
specified by the opcode. The source/destination of operands can be a constant, the memory or one
of the general-purpose registers.
• The steps of executing an instruction(the fetch-execution cycle) are:
• Fetch
1. Fetch an instruction from memory
2. Decode the instruction to determine the operation
3. Fetch data from memory if necessary
• Execution
1. Perform the operation on the data
2. Store the result in memory if needed
Programming Languages:
• Machine language
• A CPU can only execute machine language instructions
• Instructions consist of binary code: 1s and 0s
• Assembly language
• A programming language that uses symbolic names to represent operations, registers and
memory locations.
• Readability of instructions is better than machine language
• One-to-one correspondence with machine language instructions to machine code
• Assemblers translates assembly code to machine code
• High Level Language
• Compilers translate high-level programs to machine code directly or indirectly via an
assembler
Number Systems
• Decimal Number System
• There are ten basic symbols(digits): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
• The base ten is represented in decimal as 10
• 3932=3 × 103+ 9 ×102 +3 ×101 +2 ×100
• Binary Number System
• There are two digits: 0 and 1
• The base 2 is represented in binary as 10
• 11010=1× 24 +1× 23 +0 ×22 +1× 21+ 0 ×20
• Hexadecimal Number System
• There are fifteen digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
• The base is sixteen is represented in hex by 10
• 1 A=1 ×161 +10 ×16 0
Converting Binary and Hex to Decimal
Subtraction
Integer Representation:
• Unsigned Integers
• Represents a magnitude so it is never negative
• Largest unsigned integer stored in a byte is 11111111b = FFh =255d
• Biggest unsigned integer stored in a word is 1111111111111111b = FFFFh = 65535d
• If least significant bit is 0 then number is even otherwise number is odd
• Example: Addresses of memory locations, ASCII character codes
• Signed Integers
• It can either be positive or negative
• Most significant bit is reserved for sign: 0 for positive and 1 for negative
• Negative integers are stored in a computer as two’s complement
Decimal Interpretations:
• Unsigned Decimal Interpretation
• Binary to decimal conversion
• Signed Decimal Interpretation
• If MSB is 0 then signed decimal is same as unsigned decimal
• If MSB is 1 take two’s complement and convert it to decimal
Decimal Interpretation:
• Most significant bit of a positive signed integer is 0. So the leading hex digit of a positive signed
integer is 0-7h. Integers beginning with 8-Fh have 1 in their sign bit so they are negative
• For a word largest positive signed integer is 7FFFh=32767 and smallest negative signed integer is
8000h=-32768
• For a byte largest positive signed integer is 7Fh=127 and smallest negative signed integer is 80h=--
128
• For 0000h-7FFFh and 00h-7Fh, signed decimal=unsigned decimal
• For 8000h-FFFFh, signed decimal =unsigned decimal-65536
• For 80h-FFh,signed decimal =unsigned decimal-256
Character Representation
• ASCII Code
• Most popular encoding scheme for characters
• Uses seven bits to code each character so there are total of 128 ASCII codes
• Only 95 ASCII codes from 32-126 are considered to be printable
• Others are used for communication control purposes
• Keyboard
• Identifies a key by generating an ASCII code when the key is pressed
• For IBM-PC each key is assigned an unique number called scan code