Mar 14, 2010

8085 Timing Diagram

Introduction
Timing plays a crucial role, not only in sports like cricket but also in digital electronic equipments like microprocessors. Timing and Timing diagram plays a vital role in microprocessors.
What is a timing diagram? What role it plays with respect to microprocessors? Let’s discuss about these concepts in details.

What is a Timing Diagram?

The timing diagram is the diagram which provides information about the various conditions of signals such as high/low, when a machine cycle is being executed. Without the knowledge of timing diagram it is not possible to match the peripheral devices to the microprocessors. These peripheral devices includes memories, ports etc. Such devices can only be matched with microprocessors with the help of timing diagram.

Before dealing with timing diagram, we have to make ourselves familiar with certain terms.

Instruction cycle:
Assume that the microprocessor is executing an instruction. Instruction cycle is nothing but the time taken to complete the execution of that instruction by the microprocessor. The 8085 instruction cycle consists of 1 to 6 machine cycles.

Machine Cycle:
Machine cycle is nothing but the time required to complete one operation of accessing memory, I/O. It is also the time required to complete one operation of acknowledging an external request. One machine cycle may consist of 3 to 6 T-states.

T-state:
T-state is nothing but one subdivision of the operation performed in one clock period. These subdivisions are internal state of the microprocessor synchronized with system clock.


Now let us discuss the timing diagram for various signals that are associated with 8085 microprocessor.

Timing diagram of various signals

Address latch enable:
Address latch enable is an active high signal. (i.e.) the latch becomes enabled when the signal is high. It is activated during the beginning of T1 state of each machine cycle and it remains active in the T1state. But in case of bus idle machine cycle it is not activated.

Data Bus (D0-D7):
While dealing with data bus, two types of data flow are possible. The data can be transferred from memory to microprocessor and vice versa.

This process occurs during the T2 and T3 states.

There are 2 cycles. One is Read machine cycle and the other is write machine cycle. In read machine cycle, the data will appear during the later part of T2 state, while in Write machine cycle the data will appear on the beginning of T2 state.

But for reading a data from memory or I/O device, first we need to select the required device. After selecting the device, the required data to be read or written is taken from the selected location and placed on data bus. A certain amount of time is required to perform this action. This time is called “access time”. But for write cycle the access time is 0. This is because the data to be written is present on the registers of microprocessor and so it can put the data directly to data bus without any time delay.

Lower byte address (A0-A7):
The lower byte of address is available on the time multiplexed address/date bus during the T1 state of machine cycle, except the bus idle machine cycle.

Higher byte addresses (A8-A15):
The higher byte addresses (A8-A15) is available for T1, T2 and T3 states of each machine cycle, except the bus idle machine cycle.

IO/M’, S0, S1:
From the previous discussions about 8085 microprocessor, we very well know that IO/M’, S0, S1 are the status signals of the microprocessor. These status signals decide the type of machine cycle is to be executed. So they remain activated from the beginning T1 state of a particular machine cycle and remains till the end of that machine cycle.

RD’ and WR’:
These 2 signals RD’ and WR’ decides the direction of the data transfer.

RD’ is Active: When RD’ goes active, the data is transmitted from memory, I/O device or any other peripherals to the microprocessor.

WR’ is active: When WR’ goes active, the data is transmitted from microprocessor to the memory or any other peripheral devices.

Now there might be a question arising within your mind.

Can both the signals become active at same time? The answer for this question is NO.

In 8085 microprocessor either RD’ goes high or WR’ goes high. Both cannot take place at same time.

The data transfer both RD’ and WR’ takes place during T2 and T3 states of machine cycle. So these signals are activated during the T2 and T3 states.

8085 : Addressing Mode

Learn about the addressing modes of 8085 microprocessor, what are the different types of addressing modes available for 8085 microprocessor and the significance of the addressing modes explained with examples.


We have been doing a series of microprocessor education articles and till date we have discussed about the evolution of microprocessors, architecture, pin diagram and signal diagrams of 8085 microprocessor. We also discussed about how the signals helps in processing data, storing them and executing them.


But we cannot carry out a process with a microprocessor with only signals and instructions. We need a data to operate. Every instruction has to operate on a data.


There is a method in which the instructions address the data to be operated. The method of specifying the data to be operated by the instruction is known as addressing.
Now we know what is addressing. But what are addressing modes?

The way by which the microprocessor identifies the operands for a particular instruction is known as Addressing mode.

Types of Addressing Modes


The process of identifying the operands for a particular instruction can be carried out in several ways. The various types of addressing modes are as shown below.
1. Immediate addressing mode
2. Direct addressing mode
3. Register addressing mode
4. Register indirect addressing mode
5. Implicit addressing mode

Lets see the details:


1. Immediate Addressing Mode:
In this type of addressing mode the operand is specified within the instruction itself.
Let us discuss with an example.
Consider this instruction:
ADI 34H – This instruction adds the immediate data, 34H to the accumulator.
34H is the data here. H represents Hexadecimal value and the immediate value is added to the accumulator. In this case 34H is added to the accumulator. Suppose if accumulator has a value 8H and when this instruction is executed, 34H is added to the 8H and the result is stored in accumulator.
In the above instruction the operand is specified within instruction itself.

2. Direct Addressing Mode:
In this mode of addressing, the address of the data (operand) is specified within the instruction.
There is a subtle difference between the direct addressing modes and immediate addressing modes. In immediate addressing mode the data itself is specified within instruction, but in direct addressing mode the address of the data is specified in the instruction.
Example:
OUT 10H
LDA 4100H
STA 2000H
Consider the instruction STA 2000H
When this instruction is executed, the contents of the accumulator are stored in the memory location specified. In the above example the contents of accumulator are stored in memory location 2000H.

3. Register Addressing Mode:
In this type of addressing mode the instruction specifies the name of the register in which the data is available and Opcode specifies the name (or) address of the register on which the operation would be performed.
Example:
MOV A, B
Here the Opcode is MOV. If the above instruction is executed, the contents of Register B are moved to the Register A, which is nothing but the accumulator.

Other examples:
ANA B
On executing the above instruction the contents of Register B or logically ANDed with contents of register A (accumulator).
SUB H
If we execute the above instruction the contents of Register H will be subtracted from the contents of the accumulator.

4. Register Indirect Addressing Mode:
This is indirect way of addressing. In this mode the instruction specifies the name of the register in which the address of the data is available.
Example:
MOV A, M
SUB M
DCR M
Consider MOV A, M. This instruction will move the contents of memory location, whose address is in H-L register pair to the accumulator.
M represents the address present in the H-L register pair. So when MOV A, M is executed, the contents of the address specified in H-L register pair are moved to accumulator.

5. Implicit Addressing Mode:
There are certain instructions in 8085 which does not require the address of the operand to perform the operation. They operate only upon the contents of accumulator.
Example:
CMA
RAL
RAR
CMA complements the contents of accumulator.
If RAL is executed the contents of accumulator is rotated left one bit through carry.
If RAR is executed the contents of accumulator is rotated right one bit through carry.

Feb 9, 2010

8085 Instruction Set


I am going to go through an in-depth explaination of ALL the 8085 instructions.

Instructions can be categorized according to their method of addressing the hardware registers and/or memory.

Data Transfer Croup:

The data transfer instructions move data between registers or between memory and registers.



MOV Move

MVI Move Immediate

LDA Load Accumulator Directly from Memory

STA Store Accumulator Directly in Memory

LHLD Load H & L Registers Directly from Memory

SHLD Store H & L Registers Directly in Memory



An 'X' in the name of a data transfer instruction implies that it deals with a register pair (16-bits);



LXI Load Register Pair with Immediate data

LDAX Load Accumulator from Address in Register Pair

STAX Store Accumulator in Address in Register Pair

XCHG Exchange H & L with D & E

XTHL Exchange Top of Stack with H & L



Arithmetic Group:

The arithmetic instructions add, subtract, increment, or decrement data in registers or memory.



ADD Add to Accumulator

ADI Add Immediate Data to Accumulator

ADC Add to Accumulator Using Carry Flag

ACI Add Immediate data to Accumulator Using Carry

SUB Subtract from Accumulator

SUI Subtract Immediate Data from Accumulator

SBB Subtract from Accumulator Using Borrow (Carry) Flag

SBI Subtract Immediate from Accumulator Using Borrow (Carry) Flag

INR Increment Specified Byte by One

DCR Decrement Specified Byte by One

INX Increment Register Pair by One

DCX Decrement Register Pair by One

DAD Double Register Add; Add Content of Register

Pair to H & L Register Pair



Logical Group:

This group performs logical (Boolean) operations on data in registers and memory and on condition flags.



The logical AND, OR, and Exclusive OR instructions enable you to set specific bits in the accumulator ON or OFF.



ANA Logical AND with Accumulator

ANI Logical AND with Accumulator Using Immediate Data

ORA Logical OR with Accumulator

OR Logical OR with Accumulator Using Immediate Data

XRA Exclusive Logical OR with Accumulator

XRI Exclusive OR Using Immediate Data



The Compare instructions compare the content of an 8-bit value with the contents of the accumulator;



CMP Compare

CPI Compare Using Immediate Data



The rotate instructions shift the contents of the accumulator one bit position to the left or right:



RLC Rotate Accumulator Left

RRC Rotate Accumulator Right

RAL Rotate Left Through Carry

RAR Rotate Right Through Carry



Complement and carry flag instructions:



CMA Complement Accumulator

CMC Complement Carry Flag

STC Set Carry Flag



Branch Group:

The branching instructions alter normal sequential program flow, either unconditionally or conditionally. The unconditional branching instructions are as follows:



JMP Jump

CALL Call

RET Return



Conditional branching instructions examine the status of one of four condition flags to determine whether the specified branch is to be executed. The conditions that may be specified are as follows:



NZ Not Zero (Z = 0)

Z Zero (Z = 1)

NC No Carry (C = 0)

C Carry (C = 1)

PO Parity Odd (P = 0)

PE Parity Even (P = 1)

P Plus (S = 0)

M Minus (S = 1)



Thus, the conditional branching instructions are specified as follows:



Jumps Calls Returns

C CC RC (Carry)

INC CNC RNC (No Carry)

JZ CZ RZ (Zero)

JNZ CNZ RNZ (Not Zero)

JP CP RP (Plus)

JM CM RM (Minus)

JPE CPE RPE (Parity Even)

JP0 CPO RPO (Parity Odd)



Two other instructions can affect a branch by replacing the contents or the program counter:



PCHL Move H & L to Program Counter

RST Special Restart Instruction Used

with Interrupts



Stack I/O, and Machine Control Instructions:

The following instructions affect the Stack and/or Stack Pointer:



PUSH Push Two bytes of Data onto the Stack

POP Pop Two Bytes of Data off the Stack

XTHL Exchange Top of Stack with H & L

SPHL Move content of H & L to Stack Pointer



The I/0 instructions are as follows:



IN Initiate Input Operation

OUT Initiate Output Operation



The Machine Control instructions are as follows:

EI Enable Interrupt System

DI Disable Interrupt System

HLT Halt

NOP No Operation

Feb 8, 2010

Basic Components


















Some basic components in uP & uC

1. An electronic circuit board can contain millions of transistors and many other tiny electronic parts. But what are these parts and what do they do? Take a close look at what goes inside electronics and learn the function of each component.

2. Transistors
Transistors come in several different types and amplify electric current. They can also turn electricity on or off. The electronic component on the next page has the opposite function.

3. Resistors
Resistors control the flow of electrical current, and are commonly used to control volume in electronic devices like TVs. If you aren't careful, the power in the next component might kill you if you handle it improperly.

4. Electrolytic Capacitors
Capacitors are like batteries, but they dump their entire charge in a tiny fraction of a second, where a battery would take minutes. They are commonly used for anything that requires a flash, such as a camera. They can also be used to even out voltage or block DC current. See other types of capacitors next.

5. Other Capacitors
While the electrolytic capacitor on the previous page is the most popular, other common capacitor types include ceramic, plastic film types and tantalum. They are often less expensive than electrolytic capacitors and better for electronics that don't require intensity. Protect your circuit with the next part.

6. Diodes
Diodes allow electricity to flow in one direction and are usually used as a form of protection. Above, the diodes are red with resistors on the left. Take a look at a LED next.

7. Light-emitting Diode (LED)
Basically, LEDs are just tiny light bulbs that fit easily into an electrical circuit. Some uses of LEDs include forming the numbers on digital clocks, transmiting information from remote controls, lighting up watches and telling you when your appliances are turned on. Collected together, they can illuminate a traffic light. Learn what inductors do next.

8. Inductors
An inductor is about as simple as an electronic component can get -- it is simply a coil of wire. It is used in traffic light sensors and if you team up an inductor with a capacitor you create an oscillator. Learn everyday things that use oscillators next.

9. Oscillator
Oscillators move energy back and forth between two forms. A quartz watch uses a quartz oscillator to keep track of what time it is. An AM radio transmitter uses an oscillator to create the carrier wave for the station and there are also oscillators in computers, metal detectors and stun guns. Next, see the component that made computing possible.

10. Semiconductor Chip/Integrated Circuit
An integrated circuit, also called a chip, may contain millions of transistors and other components surrounded by a plastic or ceramic case. It connects to a circuit board via the metal pins seen above. Chips are often used in cars, computers, calculators and more. Next, learn about microcontrollers.

11. Microcontrollers
Most modern electronic devices -- TVs, VCRs, microwaves and so on -- contain an embedded microcontroller It's basically a dedicated computer. Next, see a microprocessor, which is a key component in computers.

12. Microprocessors
A microprocessor -- also known as a CPU or central processing unit -- is a complete computation engine that is fabricated on a single chip. Pictured above is the back side of the Core i7 chip with Nehalem microarchitecture. You can also fire up your electronics engine with the next component.

13. Brushless Electric Motor
In a brushless DC motor (BLDC), you put the permanent magnets on the rotor and you move the electromagnets to the stator. Then you use a computer (connected to high-power transistors) to charge up the electromagnets as the shaft turns. You'll likely need the next part to even get your motor started.

14. Relays
A relay is a simple electromechanical switch made up of an electromagnet and a set of contacts. Relays are quite common in home appliances where there is an electronic control turning on something like a motor or a light. See what device is used to get electricity to your gadgets next.

15. Chip on top with a transistor and LED below. Pictured above is another LED surrounded by resistors and diodes.

16. Power-cube Transformer
The purpose of a transformer is to convert one AC voltage to another AC voltage. A typical home probably has five to 10 of these little transformers plugged into the wall at any given time, and they are used with printers, speakers, cell phone chargers, electric drills and more.

8085 Architecture



The 8085 is a conventional von Neumann design based on the Intel 8080. Unlike the 8080 it had no state signals multiplexed onto the data bus, but the 8-bit data bus was instead multiplexed with the lower part of the 16-bit address bus (in order to limit the number of pins to 40). The processor was designed using nMOS circuitry and the later "H" versions were implemented in Intel's enhanced nMOS process called HMOS, originally developed for fast static RAM products. The 8085 used approximately 6,500 transistors

INTEL 8085



INTEL 8085

The Intel 8085 is an 8-bit microprocessor introduced by Intel in 1977. It was binary-compatible with the more-famous Intel 8080 but required less supporting hardware, thus allowing simpler and less expensive microcomputer systems to be built.

The "5" in the model number came from the fact that the 8085 required only a +5-volt (V) power supply rather than the +5V, -5V and +12V supplies the 8080 needed. Both processors were sometimes used in computers running the CP/M operating system, and the 8085 later saw use as a microcontroller (much by virtue of its component count reducing feature). Both designs were eclipsed for desktop computers by the compatible but more capable Zilog Z80, which took over most of the CP/M computer market as well as taking a large share of the booming home computer market in the early-to-mid-1980s.

The 8085 had a very long life as a controller. Once designed into such products as the DECtape controller and the VT100 video terminal in the late 1970s, it continued to serve for new production throughout the life span of those products (generally many times longer than the new manufacture lifespan of desktop computers).

Why Microcontroller?




Microcontrollers are hidden inside a surprising number of products these days. If your microwave oven has an LED or LCD screen and a keypad, it contains a microcontroller. All modern automobiles contain at least one microcontroller, and can have as many as six or seven: The engine is controlled by a microcontroller, as are the anti-lock brakes, the cruise control and so on. Any device that has a remote control almost certainly contains a microcontroller: TVs, VCRs and high-end stereo systems all fall into this category. Nice SLR and digital cameras, cell phones, camcorders, answering machines, laser printers, telephones (the ones with caller ID, 20-number memory, etc.), pagers, and feature-laden refrigerators, dishwashers, washers and dryers (the ones with displays and keypads)... You get the idea. Basically, any product or device that interacts with its user has a microcontroller buried inside.

In this article, i just want to share the general information on microcontroller (uC) so that you can understand what they are and how they work.

More on microcontroller


Why microcontroller is needed?

A microprocessor can't work as a stand alone unit so to make it work we have to interface memory and input out devices and so the PCB of microprocessor based system will be larger. Microcontroller consists of:
1. Processor,
2. Memory and peripherals on a single chip and so needs no interfacing.
Microcontroller can be programmed for any specific task.

More on microcontroller

Why microcontroller is needed?

A microprocessor cant work as a stand alone unit so to make it work we have to interface memory and input out devices and so the PCB of microprocessor based system will be larger. Otherwise Microcontroller consists of processor, memory and peripherals on a single chip and so needs no interfacing.The other things, Microcontroller can be programmed for any specific task and can operated by battery.

Feb 7, 2010

Introduction


What is microprocessor?

A device that integrates the functions of the central processing unit (CPU) of a computer onto one semiconductor chip or integrated circuit (IC). In essence, the microprocessor contains the core elements of a computer system, its computation and control engine. Only a power supply, memory, peripheral interface ICs, and peripherals (typically input/output and storage devices) need be added to build a complete computer system. See also Computer peripheral devices.

A microprocessor consists of multiple internal function units. A basic design has an arithmetic logic unit (ALU), a control unit, a memory interface, an interrupt or exception controller, and an internal cache. More sophisticated microprocessors might also contain extra units that assist in floating-point match calculations, program branching, or vector processing (see illustration).


A microprocessor consists of multiple independent function units. The memory interface fetches instructions from, and writes data to, external memory. The control unit issues one or more instructions to other function units. These units process the instructions in parallel to boost performance.

The ALU performs all basic computational operations: arithmetic, logical, and comparisons.

The control unit orchestrates the operation of the other units. It fetches instructions from the on-chip cache, decodes them, and then executes them. Each instruction has the control unit direct the other function units through a sequence of steps that carry out the instruction's intent. The execution path taken by the control unit can depend upon status bits produced by the arithmetic logic unit or the floating-point unit (FPU) after the instruction sequence completes. This capability implements conditional execution control flow, which is a critical element for general-purpose computation. See also Bit.

The memory interface enables the microprocessor to maintain two-way communication with off-chip semiconductor memory, which stores programs and data. This interface typically supports memory reads and writes in blocks of words (the number of bits that the processor operates on at one time). The block size facilitates burst data transfers to and from the chip's internal cache. See also Semiconductor memories.

The interrupt or exception controller enables the microprocessor to respond to requests from the external environment or to error conditions by allowing interruptions of the ongoing operation. An interrupt might be an external peripheral requesting service, while an exception typically consists of a floating-point math error or an unrecognized instruction. The interrupt controller can prioritize and selectively handle these interrupts.

The internal cache is an on-chip memory storage area that holds recently used data values or instruction sequences that are likely to be used again in the near future. Since this information is already on-chip, it can be accessed rapidly, thereby accelerating the computation rate. Items not in the cache can take several or more extra operations to access, which significantly degrades the computation rate. Software writers often organize a program's code and data structures so that the most frequently used elements often occupy the cache, thus maintaining a high level of computational throughput. See also Computer storage technology; Computer systems architecture.

The design of instruction sets (the commands that produce basic work when executed by the microprocessor) often influences the design of the microprocessor itself. Instruction sets—and as a consequence, the microprocessor architecture—are of two types: reduced instruction set computers (RISC) and complex instruction set computers (CISC). Because of the limits of early computer technology, most computers were by necessity RISC machines. Since most of the software was written in assembly language (that is, a programming language that represented the program's intent in actual machine instructions), there was a drive to build instruction sets of greater sophistication and complexity. These new CISC instruction sets made assembly language programming easier, but they also made it difficult to build high-speed computer hardware. First, CISC instructions were harder to decode. In addition, since CISC instructions involved long and complex operation sequences, they incurred a major cost by requiring more complicated logic to implement. Second, such instructions were also difficult to interrupt or abort if an exception occurred. Finally, such instructions usually carried many data dependencies that made it more difficult to support advanced architectural techniques. By returning to a RISC design, much faster computers can be built. In fact, an enhancement in performance by a factor of 2 to 3 has been attributed to this simple organizational change. To achieve these efficiencies, most of the RISC microprocessor's function units must be kept as busy as possible. This requires optimizing compilers that can translate a program's high-level source code and then reorder the resulting low-level instructions in such a way as to ensure the high throughput. See also Computer programming; Programming languages.

Microprocessors are found in virtually every consumer product that requires electric power, such as microwave ovens, automobiles, video recorders, cellular telephones, digital cameras, and hand-held computers. High-performance microprocessors implement the servers that store and distribute Web content, such as streaming audio and video, desktop computers, and the high-speed network switches that constitute the Web's infrastructure. More modest-powered microprocessors are at the heart of notebook computers and electronic games. Low-power microprocessors provide the control and flow logic of hand-held devices, digital cameras, cellular and cordless phones, pagers, and the diagnostic and pollution control of automobile engines.

What is microcontroller?

A single chip that contains the processor (the CPU), non-volatile memory for the program (ROM or flash), volatile memory for input and output (RAM), a clock and an I/O control unit. Also called a "computer on a chip," billions of microcontroller units (MCUs) are embedded each year in a myriad of products from toys to appliances to automobiles. For example, a single vehicle can use 70 or more microcontrollers.

Microcontrollers come in all sizes and architectures, with the smaller, commodity chips costing as little as 50 cents in quantities of 10,000.