Showing posts with label Microcomputer. Show all posts
Showing posts with label Microcomputer. Show all posts

Thursday, March 31, 2016

ROM and RAM Memory

Semiconductor Memory

Semiconductor memories are used as primary storage for code and data. Semiconductor memories are connected directly to the CPU and they are the memory that the CPU first asks for information (code and data). For this reason, semiconductor memories are sometimes referred to as primary memory. The most widely used semiconductor memories are ROM and RAM.

The number of bits that a semiconductor memory chip can store is called chip capacity. The number of bits that each location within the memory chip can hold is always equal to the number of data pins on the chip. The number of locations within a memory IC always equals 2 to the power of the number of address pins. Therefore, the total number of bits that a memory chip can store is equal to the number of locations times the number of data bits per location. The speed at which its data can be accessed of the memory chip is commonly referred to as its access time. The access time of memory chips varies from a few nanoseconds to hundreds of nanoseconds, depending on the IC technology used in the design and fabrication process.

ROM: ROM is a type of memory that does not lose its contents when the power is turned off. For this reason, ROM is also called nonvolatile memory.

PROM and OTP: PROM refers to the kind of ROM that the user can burn information into. In other words, PROM is a user-programmable memory. For every bit of the PROM, there exists a fuse. PROM is programmed by blowing the fuses. If the information burned into PROM is wrong, that PROM must be discarded since its internal fuses are blown permanently. For this reason, PROM is also referred to as OTP (one-time programmable). Programming ROM, also called burning ROM, requires special equipment called a ROM burner or ROM programmer.

EPROM and UV-EPROM: EPROM was invented to allow making changes in the contents of PROM after it is burned. In EPROM, one can program the memory chip and erase it thousands of times. A widely used EPROM is called UV-EPROM, where UV stands for ultraviolet. The only problem with UV-EPROM is that erasing its contents can take up to 20 minutes.

EEPROM: EEPROM has several advantages over EPROM, such as the fact that its method of erasure is electrical and therefore instant, as opposed to the 20-minute erasure time required for UV-EPROM. In addition, in EEPROM one can select which byte to be erased, in contrast to UV-EPROM, in which the entire contents of ROM are erased. However, the main advantage of EEPROM is that one can program and erase its contents while it is still in the system board. It does not require physical removal of the memory chip from its socket. In other words, unlike UV-EPROM, EEPROM does not require an external erasure and programming device.

Flash Memory: flash EPROM has become a popular user-programmable memory chip, and for good reasons. First, the erasure of the entire contents takes less than a second, or one might say in a flash, hence its name, flash memory. In addition, the erasure method is electrical, and for this reason it is sometimes referred to as flash EEPROM. To avoid confusion, it is commonly called flash memory. The major difference between EEPROM and flash memory is that when flash memory’s contents are erased, the entire device is erased, in contrast to EEPROM, where one can erase a desired section or byte. Although in some flash memories recently made available the contents are divided into blocks and the erasure can be done block by block, unlike EEPROM, flash memory has no byte erasure option.

Mask ROM: Mask ROM refers to a kind of ROM in which the contents are programmed by the IC manufacturer. In other words, it is not a user-programmable ROM. The term mask is used in IC fabrication. The main advantage of mask ROM is its cost, since it is significantly cheaper than other kinds of ROM.

RAM: RAM memory is called volatile memory since cutting off the power to the IC results in the loss of data. Sometimes RAM is also referred to as RAWM (read and write memory), in contrast to ROM, which cannot be written to.

SRAM: Storage cells in static RAM memory are made of flip-flops and therefore do not require refreshing in order to keep their data. The problem with the use of flip-flops for storage cells is that each cell requires at least 6 transistors to build, and the cell holds only 1 bit of data. In recent years, the cells have been made of 4 transistors, which still is too many.

NVRAM: Whereas SRAM is volatile, there is a new type of nonvolatile RAM called NV-RAM. Like other RAMs, it allows the CPU to read and write to it, but when the power is turned off the contents are not lost. NV-RAM combines the best of RAM and ROM: the read and write ability of RAM, plus the non-volatility of ROM. It uses an internal lithium battery as a backup energy source. The internal lithium power source is used to retain the NV-RAM contents only when the external power source is off.

Checksum Byte ROM: To ensure the integrity of the ROM contents, every system must perform the checksum calculation. The process of checksum will detect any corruption of the contents of ROM. One of the causes of ROM corruption is current surge, either when the system is turned on or during operation. To ensure data integrity in ROM, the checksum process uses what is called a checksum byte. The checksum byte is an extra byte that is tagged to the end of a series of bytes of data. To calculate the checksum byte of a series of bytes of data, the following steps can be taken.
  • Add the bytes together and drop the carries
  • Take the 2′s complement of the total sum, and that is the checksum byte, which becomes the last byte of the series
  • To perform the checksum operation, add all the bytes, including the checksum byte. The result must be zero. If it is not zero, one or more bytes of data have been changed (corrupted).
Dynamic RAM: Intel Corporation introduced the first dynamic RAM (random access memory) and it used a capacitor to store each bit. Using a capacitor to store data cuts down the number of transistors needed to build the cell; however, it requires constant refreshing due to leakage. This is in contrast to SRAM (static RAM), whose individual cells are made of flip-flops. The use of capacitors as storage cells in DRAM results in much smaller net memory cell size.
The major advantages are high density (capacity), cheaper cost per bit, and lower power consumption per bit. The disadvantage is that it must be refreshed periodically because the capacitor cell loses its charge; furthermore, while DRAM is being refreshed, the data cannot be accessed. This is in contrast to SRAM’s whose contents can be accessed at any time.

DRAM has a problem of packing a large number of cells into a single chip with the normal number of pins assigned to addresses. A 64K-bit chip (64Kxl) must have 16 address pins and 1 data pin, power, ground and control pins. To reduce the number of pins needed for addresses, multiplexing/demultiplexing is used. The method used is to split the address in half and send in each half of the address through the same pins, thereby requiring fewer address pins. Internally, the DRAM structure is divided into a square of rows and columns. The first half of the address is called the row and the second half is called the column. For example, in the case of DRAM of 64Kxl organization, the first half of the address is sent in through the 8 pins AO – A7, and by activating RAS (row address strobe), the internal latches inside DRAM grab the first half of the address. After that, the second half of the address is sent in through the same pins, and by activating CAS (column address strobe), the internal latches inside DRAM latch the second half of the address. This results in using 8 pins for addresses plus RAS and CAS, for a total of 10 pins, instead of the 16 pins that would be required without multiplexing. To access a bit of data from DRAM, both row and column addresses must be provided. Due to the complexities associated with DRAM interfacing (RAS, CAS, the need for multiplexer and refreshing circuitry), there are DRAM controllers designed to make DRAM interfacing much easier. 16Kx4 DRAM has 7 pins (AO – A6) for the address pins, 2 pins for RAS and CAS and 4 pins for the data bus.



Related topics:
Microcomputer System   |   Microcomputer System Architecture   |   Numbering System   |   Memory Basics   |   Digital Logic   |   ASCII Code   |   Computer Internals

List of topics: Microcomputer

Friday, February 19, 2016

Choosing a Microcontroller

Criteria for Choosing a Microcontroller

Meeting Computing Needs:
  • Data Width: 8-bit, 16-bit or 32-bit microcontroller
  • Speed: Highest speed that the microcontroller supports. Processing or computing power.
  • Packaging: Packaging format – dual inline package or quad flat package. This is important in terms of space and assembling.
  • Power consumption: Critical for battery powered products.
  • On-chip Memory: Amount of RAM and ROM on-chip.
  • On-chip Peripherals: Availability of peripherals like timer, ADC, PWM for product requirement.
  • IO Ports: Number of IO ports and pins.
  • Cost per unit: Important in terms of final cost of the product
  • Upgrade: How easy is to upgrade to higher performance or lower power consumption version.
Development Tools and Support:
  • Availability of software development tools like assembler, compiler, debugger, and emulator.
  • Technical support
Availability:
  • Widely and timely or readily available in needed quantities both now and in the future.



Related topics:
Computer Internals   |   Microprocessor   |   Microcontroller   |   Microprocessor Vs Microcontroller   |   Microcontroller and Embedded Systems

List of topics: Microcomputer

Microcontroller and Embedded Systems

Need for Microcontroller

  • Microprocessors contain no memory and no IO ports on the chip itself.
  • System designer using microprocessor must add memory and IO ports externally to make them functional.
  • System designer can decide on the amount of memory and IO ports needed to fit the application.
  • However, additional of external components makes the systems bulkier and much more expensive.
  • Microcontroller has a CPU (microprocessor) in addition to a fixed amount of RAM, ROM, I/O ports and a timer all on a single chip.
  • The fixed amount of memory and peripherals in microcontrollers makes them ideal for many applications in which costs and space are critical.
  • In many applications, the space it takes, the power it consumes and the price per unit are much more critical considerations than the computing power.
  • Many applications most often require some IO operations to read signals and turn on and off certain bits.
  • Microprocessors and microcontrollers are widely used in embedded system products.
  • A PC contains or connected to various embedded system products such as keyboard, mouse, printer, CD drive, modem, sound card.
  • Peripheral connected to PC has a microcontroller inside it to perform pre-defined task.
  • Microcontrollers are the preferred choice for many embedded systems.
  • For complex embedded application, an optimized version of general purpose processor is used. These processors are often called high-end embedded processor.
  • The term embedded processor and microcontroller are used interchangeably.



Related topics:
Computer Internals   |   Microprocessor   |   Microcontroller   |   Microprocessor Vs Microcontroller   |   Choosing a Microcontroller

List of topics: Microcomputer

Modified Harvard Architecture

Modified Harvard Architecture Model

Modified Harvard Architecture

True Harvard architecture - instruction memory and data memory are separated.

Modified Harvard architecture - instruction memory and data memory are the same though their buses are separated.

Modified Harvard architecture - the instruction and data separated caches of which data sources would be the same memory.

A pure Harvard architecture has disadvantage:  mechanisms must be provided to separately load the program to be executed into instruction memory and any data to be operated upon into data memory. Additionally, read-only technology for the instruction memory allows the computer to begin execution of a pre-loaded program as soon as power is applied. The data memory will at this time be in an unknown state, so it is not possible to provide any kind of pre-defined data values to the program.
The solution is to provide a hardware pathway and machine language instructions so that the contents of the instruction memory can be read as if they were data. Initial data values can then be copied from the instruction memory into the data memory when the program starts. If the data is not to be modified (for example, if it is a constant value, such as pi, or a text string), it can be accessed by the running program directly from instruction memory without taking up space in data memory (which is often at a premium).

Nowadays most CPU has Von Neumann like unified address space and also separate instruction and data caches as well as memory protection, making them more Harvard-like.

Modern general-purpose high-performance processors use separate instruction and data caches, and so could be classified as modified Harvard even though they use a unified address space.



Related topics:
Von Neumann Architecture   |   Harvard Architecture   |   Von Neumann Vs Harvard Architecture   |   Microprocessor Vs Microcontroller   |   Choosing a Microcontroller

List of topics: Microcomputer

Von Neumann Vs Harvard Architecture

Comparison of Von Neumann and Harvard Computer Architecture

Von Neumann Vs Harvard Architecture

Von NeumannHarvard
The name Harvard Architecture comes from the Harvard Mark I relay-based computerThe von Neumann Architecture is named after the mathematician and early computer scientist John von Neumann
Same memory holds data, instructionsSeparate memories for data and instructions
A single set of address/data buses between CPU and memoryTwo sets of address/data buses between CPU and memory
CPU is allowed to access either program or data memory at a time. data transfers and instruction fetches must be scheduledIt is possible to access program memory and data memory simultaneously
Program memory is read-writeProgram memory is read only
program can be easily modified by itself since it is stored in read-write memoryimpossible for program contents to be modified by the program itself
Unified cache should be usedSeparate cache should be used
Program and data memory characteristics must be sameProgram and data memory characteristics need not be same



Related topics:
Von Neumann Architecture   |   Harvard Architecture   |   Modified Harvard Architecture   |   Microprocessor Vs Microcontroller   |   Choosing a Microcontroller

List of topics: Microcomputer

Harvard Architecture

Harvard Computer Model

Harvard Architecture - Blocks
  • Separate Memory for Program and Data
  • Separate signals or bus or path for accessing program and data memory
  • Program and Data memory can be accesses simultaneously
  • Program memory is read-only
  • Data memory is read-write
  • Impossible for program contents to be modified by program itself
  • CPU can both read an instruction and perform a data memory access at the same time, even without a cache
  • There is no need to make the two memories share characteristics. In particular, the word width, timing, implementation technology, and memory address structure can differ
  • In some systems, there is much more instruction memory than data memory so instruction addresses are wider than data addresses
Key Points:
  • It allows for different media for instruction and data. A cheap ROM and expensive RAM memory.
  • It offers a level of code protection since code is stored in separate read only memory.



Related topics:
Von Neumann Architecture   |   Von Neumann Vs Harvard Architecture   |   Modified Harvard Architecture   |   Microprocessor Vs Microcontroller   |   Choosing a Microcontroller

List of topics: Microcomputer

Von Neumann Architecture

Von Neumann Computer Model

Blocks:
Von Neumann Architecture - Blocks
  • Contains three main blocks: CPU, Memory, IO devices
  • These blocks are connected together using System Bus
Components:
Von Neumann Architecture - Components
  • Memory – Storage of Information (program and data)
  • Processing Unit – Computation/Processing of Information
  • Input – Getting information in to computer
  • Output – Getting information out of computer
  • Control Unit – Monitor and control all the above
Key Points:
  • A memory to store both program and data
  • Address and Data bus are shared between program and data memory
  • CPU is allowed to access either program or data memory at a time
  • Limited data transfer between CPU and memory
  • Program can be easily modified by itself since it is stored in read-write memory
  • It offers flexibility like executing code in data memory. Programs are written as data then executed as instructions. And having a uniform address space means that main memory can be used as instructions or data as different situations demand.
  • Also known as Princeton Architecture.
Limitations:
  • Limited throughput because of single & shared bus design.
  • CPU is continually forced to wait for needed data to be transferred to or from memory.
Mitigations:
  • Providing cache between CPU and Memory
  • Providing separate caches for program and data
  • Providing CPU stack or other on-chip scratchpad memory to reduce memory access



Related topics:
Harvard Architecture   |   Von Neumann Vs Harvard Architecture   |   Modified Harvard Architecture   |   Microprocessor Vs Microcontroller   |   Choosing a Microcontroller

List of topics: Microcomputer

Microprocessor Vs Microcontroller

Difference between Microprocessor and Microcontroller

A microcontroller (sometimes abbreviated µC, uC or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals.

MicroprocessorMicrocontroller
Microprocessor IC has a CPU and may also have some other units like cache, floating point processing unit.Microcontroller IC has a CPU, Memory and Peripherals.
Microprocessor does not have RAM, ROM, and other peripheral on the chip. It can interface to external Memory and peripherals.Microcontroller has on-chip RAM & ROM memory and functional units like interrupt handler, Serial port, io ports, timer, ADC and PWM.
Microprocessor is used when large embedded software is to be located in the external memoryMicrocontroller is used when a small or part of the embedded software has to be located in internal memory.
Microprocessor will not be up and running as quickly as program and data are stored in external memory.Microcontroller has a very short start-up period and can be executing code very quickly as program and data memories are internal.
Microprocessor has high computational capabilities.Microcontroller has limited computational capabilities.
Microprocessor input-output capabilities depend on external factors.Microcontroller has enhanced input-output capabilities on a chip
Microprocessor are used to execute big and generic applications Microcontroller will only be used to execute application specific dedicated tasks.
Microprocessor supports more op-codes, few bit handling instructionsMicrocontroller supports fewer op- codes, more bit handling Instructions
Microprocessor is like brain.Microcontroller is like entire body
Microprocessor is one component of the microcomputerMicrocontroller is a microcomputer
Microprocessor increases the cost of the product.Microcontroller based products are cheaper.
Microprocessor based products consume more power.Microcontroller based products consume less power.
Microprocessor is used in General purpose systems.Microcontroller is used in automatically controlled device.
Microprocessor based system can perform numerous tasks.Microcontroller based system can perform single or very few tasks.
Operating clock frequency is high. Usually Mhz to GhzOperating clock frequency is low. Usually Mhz
Microprocessor have Math coprocessor to perform complex mathematical calculationsSoftware libraries has to be used to perform complex mathematical calculations
The prime use of microprocessor is to perform instruction cycle repeatedlyIn addition to instruction cycle, microcontroller also controls it environment based on output of instruction cycle.
Have more operation codes (opcodes)Have few operation codes (opcodes)
Have few bit manipulation instructionsHave numerous bit manipulation instructions
Instruction throughput is given higher priority that interrupt latencyMicrocontrollers are designed to optimize interrupt latency
Not suitable for real time systemsPreferred for real time systems
Used in Personal computersUsed in Embedded Systems



Related topics:
Computer Internals   |   Microprocessor   |   Microcontroller   |   Microcontroller and Embedded Systems   |   Choosing a Microcontroller

List of topics: Microcomputer

Microcontroller

What is a Microcontroller?

A microcontroller (sometimes abbreviated µC, uC or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals.
Microcontroller - General Model

A micro-controller is a task specific single integrated circuit, commonly with the following features:
  • central processing unit - ranging from small and simple 4-bit processors to complex 32- or 64-bit processors
  • volatile memory (RAM) for data storage
  • ROM, EPROM, EEPROM or Flash memory for program and operating parameter storage
  • discrete input and output bits, allowing control or detection of the logic state of an individual package pin
  • serial input/output such as serial ports (UARTs)
  • other serial communications interfaces like I²C, Serial Peripheral Interface and Controller Area Network for system interconnect
  • peripherals such as timers, event counters, PWM generators, and watchdog
  • clock generator - often an oscillator for a quartz timing crystal, resonator or RC circuit
  • many include analog-to-digital converters, some include digital-to-analog converters
  • in-circuit programming and debugging support



Related topics:
Computer Internals   |   Microprocessor   |   Microprocessor Vs Microcontroller   |   Microcontroller and Embedded Systems   |   Choosing a Microcontroller

List of topics: Microcomputer

Microprocessor

What is a Microprocessor?

A microprocessor (µP) is a computer processor that incorporates the functions of a computer's central processing unit (CPU) on a single integrated circuit (IC), or at most a few integrated circuits.
The simplified model of microprocessor consists of,
Microprocessor - Simplified Model

Control Unit: Consists of Instruction Fetch Unit, Instruction Decoder, Clock module, Control Logic Circuits
  • Fetch Unit – Fetch program instruction from memory
  • Decoder – Decode the instruction fetched from memory
  • Clock – Generate and Control Clock signals for synchronization
  • Control Circuits – Generate control signals
  • Controls the operation of ALU

Arithmetic and Logic Unit: Execute Arithmetic and Logical operations. It works with register array to perform
  • Addition – Using adders (Half adders and Full adders)
  • Subtraction – Using Inverters and Two’s complement arithmetic
  • Multiplication and Division – Using Math’s co-processor or special floating point hardware
  • Logical tests – Using logic gates
  • Comparison – Using logic gates
  • Bit Shifting – Using shift register
  • Boolean Operations – Using logic gates

Register Array: Group of registers. Commonly,
  • Program Counter (PC) – Holds memory address of the next instruction that has to be executed in a program
  • Instruction Register (IR) – Hold the current instruction in the processor while it is being decoded and executed
  • Accumulator (A or ACC) – Holds the result of operations performed by ALU
  • Memory Address Register (MAR) – Holds memory addresses involved in the instructions held in instruction register
  • Memory Data or Buffer Register (MDR or MBR) – Holds data fetched from memory address or data to be written in memory address
  • Flag Register/Status Flags/Condition code register – Contains the current state of the processor. It is a collection of status flag bits of a processor. Zero Flag, Carry Flag, Negative Flag, Overflow Flag
  • Stack Pointer (SP) – Holds top of the stack memory
  • General Purpose Registers – Used to hold operands of an instruction

System Bus: Comprised of control bus, data bus, address bus, Connects Processor with memory and peripherals, Transfer data across system
  • Control Bus – carries the signals relating to the control and co-ordination of the various activities
  • Data Bus – a bi-directional bus used to exchange of data between the processor, memory and peripherals
  • Address Bus – connections between the microprocessor and memory which carry the address from/to which the CPU wishes to read or write. The number of bits or lines of address bus determines the maximum size (2bits or lines) of memory which the processor can access.
  • 24 = 16 bytes
    28 = 256 bytes
    216 = 65536 bytes = 64 KB
    224 = 16777216 bytes = 16 MB
    232 = 4294967296 bytes = 4 GB
    264 = 18446744073709551616 bytes = 17,179,869,184 GB



Related topics:
Computer Internals   |   Microcontroller   |   Microprocessor Vs Microcontroller   |   Microcontroller and Embedded Systems   |   Choosing a Microcontroller

List of topics: Microcomputer

Computer Internals

Internal Organization of Computer

Computer Internals - Parts

Components:
  • Computer can be broken on to three parts: CPU (Central Processing Unit), Memory and I/O (Input/Output) devices.
  • Memory is to store (temporary or permanent) information.
  • CPU is to process information stored in memory.
  • I/O device is to provide a means of communicating with CPU.
Bus:
  • CPU is connected to memory and I/O through strips of wire called a bus.
  • Bus inside a computer carries information from one place to another.
  • There are three types of buses: address bus, data bus, and control bus.
  • For a device to be recognized by CPU, it must be assigned a unique address.
  • Address bus is used to identify the devices and memory connected to the CPU.
  • Data bus is used to carry information in and out of a CPU.
  • Control bus is to provide read or write signals to device.
  • Address bus is a unidirectional bus, which means that the CPU uses the address bus only to send out addresses.
  • The total number of memory locations addressable by a CPU is always equal to 2x where x is the number of address lines or bits.
  • Data bus is a bidirectional bus. CPU must use them to send or receive data.
  • The more lines or bits in a data bus, the better the CPU.
  • Processing power of a computer is related to the size of its busses.
Memory:
  • RAM and ROM are referred as Primary Memory.
  • Storage device such as a disk is called Secondary Memory.
  • ROM is to provide information that is fixed and permanent.
  • RAM is to store information that is not permanent and can change with time.
  • Programs such as operating system and application packages are loaded in to RAM and processed by the CPU.
CPU:
  • Program stored in memory provides information to the CPU to perform an action.
  • Function of CPU is to fetch the instructions from memory, decode and execute them.
  • CPU is equipped with ALU (Arithmetic Unit), Fetching Unit, Decoding Unit, Control Unit and Registers to perform fetch, decode and execution operations.
  • CPU uses register for temporary storage while executing instructions.
  • Program counter (PC or IP (Instruction Pointer)), a register, is to point address of the next instruction to be executed by CPU.
  • Fetching unit in CPU fetches the instructions from the address, pointed by PC, in memory.
  • Decoding unit in CPU interprets the instruction fetched in to CPU and tells what steps the CPU should take.
  • ALU is to perform add, subtract, multiply, divide and Boolean operations.
  • Control unit is to control the operations of other units.

Computer Internals - Organization



Related topics:
Microcomputer System   |   Microcomputer System Architecture   |   Numbering System   |   Memory Basics   |   Digital Logic   |   ASCII Code   |   ROM and RAM Memory

List of topics: Microcomputer

Memory Basics

Most widely used Memory Terminology in Computer

  • Memory is one of the most important feature of a computer
  • A bit is a binary digit that can have the value 0 or 1
  • A byte is defined as 8 bits
  • A nibble is half a byte, or 4 bits
  • A word is two bytes, or 16 bits
  • A kilobyte is 210 bytes, or 1024 bytes
  • A megabyte is 220 bytes, or 1024 kilobytes
  • A gigabyte is 230 bytes, or 1024 megabytes
  • A terabyte is 240 bytes, or 1024 gigabytes
  • RAM and ROM are the types of memory commonly used in computer
  • RAM stands for Random Access Memory
  • RAM is used for temporary storage of programs that it is running
  • RAM is called volatile memory. The data is lost when the computer is turned off
  • ROM stands for Read Only Memory
  • ROM is used to store programs and information essential for the operation of computer
  • ROM is called non-volatile memory. The data is lost when the computer is turned off
  • RAM and ROM memories are referred to as primary memory
  • A memory chip contains 2x locations, where x is the number of address pins
  • Each location contains y bits, where y is the number of data pins on the chip
  • The entire chip will contain 2x * y bits, where x is the number of address pins and y is the number of data pins on the chip



Related topics:
Microcomputer System   |   Microcomputer System Architecture   |   Numbering System   |   Digital Logic   |   ASCII Code   |   Computer Internals   |   ROM and RAM Memory

List of topics: Microcomputer

Digital Logic

Overview of Digital Logic

Digital Logic

Binary Logic:
  • Computer uses binary number system because the two voltage levels can be represented as the two digits 0 and 1.
  • Signals in digital electronics have two distinct voltage levels.
  • A system may define 0V as logic 0 and +5V as logic 1.
Logic Gates:
AND Logic:

  • And logic function will output a 1, if all or two of its input are 1.

  • InputsOutput
    XYX AND Y
    000
    010
    100
    111

OR Logic:
  • OR logic function will output a 1, if one or more inputs are 1.

  • InputsOutput
    XYX OR Y
    000
    011
    101
    111

XOR Logic:
  • Performs an exclusive OR operations on the input.
  • Produces 1 output if only one input is 1.
  • A way to remember XOR is "one or the other but not both".
  • Can be used to compare two bits to see if they are the same.

  • InputsOutput
    XYX XOR Y
    000
    011
    101
    110

Buffer:
  • A buffer does not change the logic level of the input.
  • Used to isolate or amplify the signal.

  • InputsOutput
    00
    11

NOT Logic:
  • NOT logic, also called Inverter, outputs the value opposite to that input to the gate.

  • InputsOutput
    XNOT X
    01
    10

NAND Logic:
  • AND logic with an inverter on the output.

  • InputsOutput
    XYX NAND Y
    001
    011
    101
    110

NOR Logic:
  • OR logic with an inverter on the output.

  • InputsOutput
    XYX NOR Y
    001
    010
    100
    110

XNOR Logic:
  • XOR logic with an inverter on the output.

  • InputsOutput
    XYX XNOR Y
    001
    010
    100
    111



Related topics:
Microcomputer System   |   Microcomputer System Architecture   |   Numbering System   |   Memory Basics   |   ASCII Code   |   Computer Internals   |   ROM and RAM Memory

List of topics: Microcomputer

Monday, February 15, 2016

ASCII Code

ASCII Character Code

  • If the second digit is greater than the first, borrow 16 from preceding digit.
  • All the information in the computer must be represented by 0s and 1s.
  • Binary patterns must be assigned to letters, numbers and other characters.
  • In 1960s a standard representation called ASCII (American Code for Information Interchange) was established.
  • ASCII assigns binary pattern for numbers, lowercase and uppercase English alphabets, symbols and other special characters.
  • ASCII system uses a total of 7 bits to represent each code.
  • Binary pattern was designed to allow for easy manipulation for ASCII data.
  • Digits 0 through 9 are represented by ASCII code 30 through 39.
  • A program can easily convert digits from ASCII to decimal by masking off the “3” in upper nibble.
  • Uppercase letters are represented by ASCII codes 41 through 5A and lowercase letters are represented by codes 61 through 7A.
  • The only bit that is different between uppercase and lowercase is bit “5”. Conversion between uppercase of lowercase is as simple as changing bit 5 of ASCII code.
ASCII Table:
Code 0 – 31: Non-Printing Control Characters
DecOctHexBinSymbolHTMLDescription
00000000000000NUL�Null char
10010100000001SOHStart of Heading
20020200000010STXStart of Text
30030300000011ETXEnd of Text
40040400000100EOTEnd of Transmission
50050500000101ENQEnquiry
60060600000110ACKAcknowledgment
70070700000111BELBell
80100800001000BSBack Space
90110900001001HT	Horizontal Tab
100120A00001010LF
Line Feed
110130B00001011VTVertical Tab
120140C00001100FFForm Feed
130150D00001101CR
Carriage Return
140160E00001110SOShift Out / X-On
150170F00001111SIShift In / X-Off
160201000010000DLEData Line Escape
170211100010001DC1Device Control 1 (oft. XON)
180221200010010DC2Device Control 2
190231300010011DC3Device Control 3 (oft. XOFF)
200241400010100DC4Device Control 4
210251500010101NAKNegative Acknowledgement
220261600010110SYNSynchronous Idle
230271700010111ETBEnd of Transmit Block
240301800011000CANCancel
250311900011001EMEnd of Medium
260321A00011010SUBSubstitute
270331B00011011ESCEscape
280341C00011100FSFile Separator
290351D00011101GSGroup Separator
300361E00011110RSRecord Separator
310371F00011111USUnit Separator

Code 32 – 127: Printable Characters
DecOctHexBinSymbolHTMLDescription
320402000100000 Space
330412100100001!!Exclamation mark
340422200100010""Double quotes (or speech marks)
350432300100011##Number
360442400100100$$Dollar
370452500100101%%Procenttecken
380462600100110&&Ampersand
390472700100111''Single quote
400502800101000((Open parenthesis (or open bracket)
410512900101001))Close parenthesis (or close bracket)
420522A00101010**Asterisk
430532B00101011++Plus
440542C00101100,,Comma
450552D00101101--Hyphen
460562E00101110..Period, dot or full stop
470572F00101111//Slash or divide
48060300011000000Zero
49061310011000111One
50062320011001022Two
51063330011001133Three
52064340011010044Four
53065350011010155Five
54066360011011066Six
55067370011011177Seven
56070380011100088Eight
57071390011100199Nine
580723A00111010::Colon
590733B00111011;&#59;Semicolon
600743C00111100<&#60;Less than (or open angled bracket)
610753D00111101=&#61;Equals
620763E00111110>&#62;Greater than (or close angled bracket)
630773F00111111?&#63;Question mark
641004001000000@&#64;At symbol
651014101000001A&#65;Uppercase A
661024201000010B&#66;Uppercase B
671034301000011C&#67;Uppercase C
681044401000100D&#68;Uppercase D
691054501000101E&#69;Uppercase E
701064601000110F&#70;Uppercase F
711074701000111G&#71;Uppercase G
721104801001000H&#72;Uppercase H
731114901001001I&#73;Uppercase I
741124A01001010J&#74;Uppercase J
751134B01001011K&#75;Uppercase K
761144C01001100L&#76;Uppercase L
771154D01001101M&#77;Uppercase M
781164E01001110N&#78;Uppercase N
791174F01001111O&#79;Uppercase O
801205001010000P&#80;Uppercase P
811215101010001Q&#81;Uppercase Q
821225201010010R&#82;Uppercase R
831235301010011S&#83;Uppercase S
841245401010100T&#84;Uppercase T
851255501010101U&#85;Uppercase U
861265601010110V&#86;Uppercase V
871275701010111W&#87;Uppercase W
881305801011000X&#88;Uppercase X
891315901011001Y&#89;Uppercase Y
901325A01011010Z&#90;Uppercase Z
911335B01011011[&#91;Opening bracket
921345C01011100\&#92;Backslash
931355D01011101]&#93;Closing bracket
941365E01011110^&#94;Caret - circumflex
951375F01011111_&#95;Underscore
961406001100000`&#96;Grave accent
971416101100001a&#97;Lowercase a
981426201100010b&#98;Lowercase b
991436301100011c&#99;Lowercase c
1001446401100100d&#100;Lowercase d
1011456501100101e&#101;Lowercase e
1021466601100110f&#102;Lowercase f
1031476701100111g&#103;Lowercase g
1041506801101000h&#104;Lowercase h
1051516901101001i&#105;Lowercase i
1061526A01101010j&#106;Lowercase j
1071536B01101011k&#107;Lowercase k
1081546C01101100l&#108;Lowercase l
1091556D01101101m&#109;Lowercase m
1101566E01101110n&#110;Lowercase n
1111576F01101111o&#111;Lowercase o
1121607001110000p&#112;Lowercase p
1131617101110001q&#113;Lowercase q
1141627201110010r&#114;Lowercase r
1151637301110011s&#115;Lowercase s
1161647401110100t&#116;Lowercase t
1171657501110101u&#117;Lowercase u
1181667601110110v&#118;Lowercase v
1191677701110111w&#119;Lowercase w
1201707801111000x&#120;Lowercase x
1211717901111001y&#121;Lowercase y
1221727A01111010z&#122;Lowercase z
1231737B01111011{&#123;Opening brace
1241747C01111100|&#124;Vertical bar
1251757D01111101}&#125;Closing brace
1261767E01111110~&#126;Equivalency sign - tilde
1271777F01111111
&#127;Delete

Code 128 – 255: Extendable codes
DecOctHexBinSymbolHTMLDescription
1282008010000000&#128;Euro sign
1292018110000001
1302028210000010&#130;Single low-9 quotation mark
1312038310000011ƒ&#131;Latin small letter f with hook
1322048410000100&#132;Double low-9 quotation mark
1332058510000101&#133;Horizontal ellipsis
1342068610000110&#134;Dagger
1352078710000111&#135;Double dagger
1362108810001000ˆ&#136;Modifier letter circumflex accent
1372118910001001&#137;Per mille sign
1382128A10001010Š&#138;Latin capital letter S with caron
1392138B10001011&#139;Single left-pointing angle quotation
1402148C10001100Œ&#140;Latin capital ligature OE
1412158D10001101
1422168E10001110Ž&#142;Latin captial letter Z with caron
1432178F10001111
1442209010010000
1452219110010001&#145;Left single quotation mark
1462229210010010&#146;Right single quotation mark
1472239310010011&#147;Left double quotation mark
1482249410010100&#148;Right double quotation mark
1492259510010101&#149;Bullet
1502269610010110&#150;En dash
1512279710010111&#151;Em dash
1522309810011000˜&#152;Small tilde
1532319910011001&#153;Trade mark sign
1542329A10011010š&#154;Latin small letter S with caron
1552339B10011011&#155;Single right-pointing angle quotation mark
1562349C10011100œ&#156;Latin small ligature oe
1572359D10011101
1582369E10011110ž&#158;Latin small letter z with caron
1592379F10011111Ÿ&#159;Latin capital letter Y with diaeresis
160240A010100000&#160;Non-breaking space
161241A110100001¡&#161;Inverted exclamation mark
162242A210100010¢&#162;Cent sign
163243A310100011£&#163;Pound sign
164244A410100100¤&#164;Currency sign
165245A510100101¥&#165;Yen sign
166246A610100110¦&#166;Pipe, Broken vertical bar
167247A710100111§&#167;Section sign
168250A810101000¨&#168;Spacing diaeresis - umlaut
169251A910101001©&#169;Copyright sign
170252AA10101010ª&#170;Feminine ordinal indicator
171253AB10101011«&#171;Left double angle quotes
172254AC10101100¬&#172;Not sign
173255AD10101101¬&#173;Soft hyphen
174256AE10101110®&#174;Registered trade mark sign
175257AF10101111¯&#175;Spacing macron - overline
176260B010110000°&#176;Degree sign
177261B110110001±&#177;Plus-or-minus sign
178262B210110010²&#178;Superscript two - squared
179263B310110011³&#179;Superscript three - cubed
180264B410110100´&#180;Acute accent - spacing acute
181265B510110101µ&#181;Micro sign
182266B610110110&#182;Pilcrow sign - paragraph sign
183267B710110111·&#183;Middle dot - Georgian comma
184270B810111000¸&#184;Spacing cedilla
185271B910111001¹&#185;Superscript one
186272BA10111010º&#186;Masculine ordinal indicator
187273BB10111011»&#187;Right double angle quotes
188274BC10111100¼&#188;Fraction one quarter
189275BD10111101½&#189;Fraction one half
190276BE10111110¾&#190;Fraction three quarters
191277BF10111111¿&#191;Inverted question mark
192300C011000000À&#192;Latin capital letter A with grave
193301C111000001Á&#193;Latin capital letter A with acute
194302C211000010Â&#194;Latin capital letter A with circumflex
195303C311000011Ã&#195;Latin capital letter A with tilde
196304C411000100Ä&#196;Latin capital letter A with diaeresis
197305C511000101Å&#197;Latin capital letter A with ring above
198306C611000110Æ&#198;Latin capital letter AE
199307C711000111Ç&#199;Latin capital letter C with cedilla
200310C811001000È&#200;Latin capital letter E with grave
201311C911001001É&#201;Latin capital letter E with acute
202312CA11001010Ê&#202;Latin capital letter E with circumflex
203313CB11001011Ë&#203;Latin capital letter E with diaeresis
204314CC11001100Ì&#204;Latin capital letter I with grave
205315CD11001101Í&#205;Latin capital letter I with acute
206316CE11001110Î&#206;Latin capital letter I with circumflex
207317CF11001111Ï&#207;Latin capital letter I with diaeresis
208320D011010000Ð&#208;Latin capital letter ETH
209321D111010001Ñ&#209;Latin capital letter N with tilde
210322D211010010Ò&#210;Latin capital letter O with grave
211323D311010011Ó&#211;Latin capital letter O with acute
212324D411010100Ô&#212;Latin capital letter O with circumflex
213325D511010101Õ&#213;Latin capital letter O with tilde
214326D611010110Ö&#214;Latin capital letter O with diaeresis
215327D711010111×&#215;Multiplication sign
216330D811011000Ø&#216;Latin capital letter O with slash
217331D911011001Ù&#217;Latin capital letter U with grave
218332DA11011010Ú&#218;Latin capital letter U with acute
219333DB11011011Û&#219;Latin capital letter U with circumflex
220334DC11011100Ü&#220;Latin capital letter U with diaeresis
221335DD11011101Ý&#221;Latin capital letter Y with acute
222336DE11011110Þ&#222;Latin capital letter THORN
223337DF11011111ß&#223;Latin small letter sharp s - ess-zed
224340E011100000à&#224;Latin small letter a with grave
225341E111100001á&#225;Latin small letter a with acute
226342E211100010â&#226;Latin small letter a with circumflex
227343E311100011ã&#227;Latin small letter a with tilde
228344E411100100ä&#228;Latin small letter a with diaeresis
229345E511100101å&#229;Latin small letter a with ring above
230346E611100110æ&#230;Latin small letter ae
231347E711100111ç&#231;Latin small letter c with cedilla
232350E811101000è&#232;Latin small letter e with grave
233351E911101001é&#233;Latin small letter e with acute
234352EA11101010ê&#234;Latin small letter e with circumflex
235353EB11101011ë&#235;Latin small letter e with diaeresis
236354EC11101100ì&#236;Latin small letter i with grave
237355ED11101101í&#237;Latin small letter i with acute
238356EE11101110î&#238;Latin small letter i with circumflex
239357EF11101111ï&#239;Latin small letter i with diaeresis
240360F011110000ð&#240;Latin small letter eth
241361F111110001ñ&#241;Latin small letter n with tilde
242362F211110010ò&#242;Latin small letter o with grave
243363F311110011ó&#243;Latin small letter o with acute
244364F411110100ô&#244;Latin small letter o with circumflex
245365F511110101õ&#245;Latin small letter o with tilde
246366F611110110ö&#246;Latin small letter o with diaeresis
247367F711110111÷&#247;Division sign
248370F811111000ø&#248;Latin small letter o with slash
249371F911111001ù&#249;Latin small letter u with grave
250372FA11111010ú&#250;Latin small letter u with acute
251373FB11111011û&#251;Latin small letter u with circumflex
252374FC11111100ü&#252;Latin small letter u with diaeresis
253375FD11111101ý&#253;Latin small letter y with acute
254376FE11111110þ&#254;Latin small letter thorn
255377FF11111111ÿ&#255;Latin small letter y with diaeresis



Related topics:
Microcomputer System   |   Microcomputer System Architecture   |   Numbering System   |   Memory Basics   |   Digital Logic   |   Computer Internals   |   ROM and RAM Memory

List of topics: Microcomputer

Hex Subtraction

Subtracting Hex Numbers

  • If the second digit is greater than the first, borrow 16 from preceding digit.
Subtract 59F – 2B8.
F9F(8 from 15 = 7)
-2B8(11 from 25 (9+16) = 14(E))
(2 from 4 (5-1) = 2)
=2E7

Subtract F88 – 9B8.
F88(8 from 8 = 0)
-9B8(11 from 24 (8+16) = 13(D))
(9 from 14 (15-1) = 5)
=5D0



Related topics:
Counting in Decimal, Binary, Hexadecimal   |   Binary Addition   |   Binary Subtraction   |   Hex Addition   |   Hexadecimal to Decimal Conversion

List of topics: Microcomputer

Hex Addition

Adding Hex Numbers

  • Starting from right, digits are added together.
  • If the result is less than 16, write that digit as the sum for that position.
  • If the result is greater than 16, subtract 16 from result to get the digit for that position and carry 1 to the next digit.
Add 23D9 + 94BE.
23D9(9 + 14 = 23)(23 – 16 = 7 with a carry)
+94BE(1 + 13 + 11 = 25)(25 – 16 = 9 with a carry)
(1 + 3 + 4 = 8)
=B897(2 + 9 = B)

Add 93D9 + 94BE.
93D9(9 + 14 = 23)(23 – 16 = 7 with a carry)
+94BE(1 + 13 + 11 = 25)(25 – 16 = 9 with a carry)
(1 + 3 + 4 = 8)
=12897(9 + 9 = 18)(18 – 16 = 2 with a carry)



Related topics:
Counting in Decimal, Binary, Hexadecimal   |   Binary Addition   |   Binary Subtraction   |   Hex Subtraction   |   Hexadecimal to Decimal Conversion

List of topics: Microcomputer

Binary Subtraction

Subtracting Binary Numbers

  • Computers use addition process to implement subtraction.
  • Computers have adder circuitry but there is no separate circuitry for subtractors.
  • To implement A-B, the computer takes the 2’s complement of B and then adds it to A.
  • 2’s Complement: Invert all the bits of a binary number and then add 1 to the result.
  • Inverting (changing all 0s to 1s and 1s to 0s) all the bits of a binary number is called 1’s complement.
Take 2’s complement of 10011101.
10011101binary number
011000101’s complement
+1
=011000112’s complement

Subtract 10011101 from 10011111.
10011111 – 10011101
= 10011111 + 2’s complement of 10011101
= 10011111 + 01100011
= 00000010 (Discard the last carry)
= 10



Related topics:
Counting in Decimal, Binary, Hexadecimal   |   Binary Addition   |   Hex Addition   |   Hex Subtraction   |   Hexadecimal to Decimal Conversion

List of topics: Microcomputer