Saturday, 16 August 2014

DC Motor Interface in 8086

;8086 Interfaced with 8255 and DC Motor
        OUTPUT 2500AD
.ORG 2000H

DATA SEGMENT
LIST DB FFH,80H,80H,80H,80H,80H,80H,00H
DATA ENDS

CODE SEGMENT
    ASSUME CS:CODE,DS:DATA
START:
        MOV AX,DATA
        MOV DS,AX
        MOV SI,OFFSET LIST
        MOV CL,08H
        MOV AL,80H
        MOV DX,FFE6H
        OUT DX,AL
L1:
        MOV AL,[SI]
        MOV DX,FFE0H
        OUT DX,AL
        CALL DELAY
        CALL DELAY
        CALL DELAY
        CALL DELAY
        CALL DELAY
        CALL DELAY   
        INC SI
        DEC CL
        JNZ L1
CODE ENDS
END

DELAY:

        MOV BX,FFFFH
L3:
        DEC BX
        JNZ L3
        RET

Stepper Motor Interface in 8086

;8086 Interfaced with 8255 PPI and Stepper Motor in Full Step Mode     
      OUTPUT 2500AD
.ORG 2000H

DATA SEGMENT
LIST DB 05H,09H,0AH,06H
DATA ENDS

CODE SEGMENT
    ASSUME CS:CODE,DS:DATA
START:
        MOV AX,DATA
        MOV DS,AX
L2:
        MOV SI,OFFSET LIST
        MOV CL,04H
        MOV AL,80H
        MOV DX,FFE6H
        OUT DX,AL
L1:
        MOV AL,[SI]
        MOV DX,FFE0H
        OUT DX,AL
        CALL DELAY   
        INC SI
        DEC CL
        JNZ L1
        JMP L2
DELAY:

        MOV BX,2200H
L3:
        DEC BX
        JNZ L3
        RET

CODE ENDS
END

;8086 Interfaced with 8255 PPI and Stepper Motor in Half Step Mode
      OUTPUT 2500AD
.ORG 2000H

DATA SEGMENT
LIST DB 05H,01H,09H,08H,0AH,02H,06H,04H
DATA ENDS

CODE SEGMENT
    ASSUME CS:CODE,DS:DATA
START:
        MOV AX,DATA
        MOV DS,AX
        MOV AL,80H
        MOV DX,FFE6H
        OUT DX,AL
        MOV CH,19H
L2:
        MOV SI,OFFSET LIST
        MOV CL,08H
L1:
        MOV AL,[SI]
        MOV DX,FFE0H
        OUT DX,AL
        CALL DELAY
        INC SI
        DEC CL
        JNZ L1
        DEC CH
        JNZ L2
        JMP LAST

DELAY:
        MOV BX,2200H
L3:
        DEC BX
        JNZ L3
        RET
LAST:
CODE ENDS
END

Digital to Analog Conversion Interface in 8086

;8086 interfaced with 8255 PPI and DAC for Square Wave Generation
        OUTPUT 2500AD
.ORG 2000H

DATA SEGMENT
DATA ENDS

CODE SEGMENT
    ASSUME CS:CODE,DS:DATA
START:
        MOV AX,DATA
        MOV DS,AX
        MOV AL,80H
        MOV DX,FFE6H
        OUT DX,AL
L1:
        MOV AL,00H
        MOV DX,FFE0H
        OUT DX,AL
        CALL DELAY
        MOV AL,FFH
        MOV DX,FFE0H
        OUT DX,AL
        CALL DELAY   
        JMP L1

DELAY:

        MOV BX,00FFH
L3:
        DEC BX
        JNZ L3
        RET
CODE ENDS
END

;8086 interfaced with 8255 PPI and DAC for Triangle Wave Generation
        OUTPUT 2500AD
.ORG 2000H

DATA SEGMENT
DATA ENDS

CODE SEGMENT
    ASSUME CS:CODE,DS:DATA
START:
        MOV AX,DATA
        MOV DS,AX
        MOV AL,80H
        MOV DX,FFE6H
        OUT DX,AL
        MOV AL,00H
L1:
        MOV DX,FFE0H
        OUT DX,AL
        INC AL
        CMP AL,FFH
        JNZ L1
L2:
        MOV DX,FFE0H
        OUT DX,AL
        DEC AL
        CMP AL,00H
        JNZ L2
        JMP L1
CODE ENDS
END

;8086 interfaced with 8255 PPI and DAC for Sine Wave Generation
OUTPUT 2500AD
.ORG 2000H

DATA SEGMENT
LIST DB 80H,8BH,96H,A1H,ABH,B6H,C0H,C9H,D2H,DAH,E4H,E8H, F0H,F3H,F9H,FBH,FDH,FFH,FFH
DATA ENDS

CODE SEGMENT
    ASSUME CS:CODE,DS:DATA
START:
        MOV AX,DATA
        MOV DS,AX
        MOV AL,80H
        MOV DX,FFE6H
        OUT DX,AL
L5:       
        MOV SI,OFFSET LIST
        MOV CL,13H
L1:
        MOV AL,[SI]
        MOV DX,FFE0H
        OUT DX,AL
        INC SI
        DEC CL
        JNZ L1
        MOV CL,13H
L2:
        DEC SI
        MOV AL,[SI]
        MOV DX,FFE0H
        OUT DX,AL
        DEC CL
        JNZ L2
        MOV SI,OFFSET LIST
        MOV CL,13H
L3:
        MOV AL,[SI]
        NEG AL
        MOV DX,FFE0H
        OUT DX,AL
        INC SI
        DEC CL
        JNZ L3
        MOV CL,13H
L4:
        DEC SI
        MOV AL,[SI]
        NEG AL
        MOV DX,FFE0H
        OUT DX,AL
        DEC CL
        JNZ L4
        JMP L5
CODE ENDS
END

Analog to Digital Conversion Interface in 8086

;8086 Microprocessor interfaced with 8255 PPI and ADC
;Read Analog input at Channel 0 of ADC0809 IC and display the digital value in the Segment Display
   OUTPUT 2500AD
.ORG 2000H

DATA SEGMENT
DATA ENDS

CODE SEGMENT
    ASSUME CS:CODE,DS:DATA
START:
        MOV AX,DATA
        MOV DS,AX
        MOV AL,98H
        MOV DX,FFE6H
        OUT DX,AL
L2:
        MOV AL,00H
        MOV DX,FFE4H
        OUT DX,AL
        MOV AL,00H
        MOV DX,FFE2H
        OUT DX,AL
        MOV AL,02H
        MOV DX,FFE4H
        OUT DX,AL
        MOV AL,03H
        MOV DX,FFE4H
        OUT DX,AL
        MOV AL,01H
        MOV DX,FFE4H
        OUT DX,AL
        MOV AL,00H
        MOV DX,FFE4H
        OUT DX,AL
L1:
        MOV DX,FFE4H
        IN AL,DX
        RCL AL,01H
        JNC L1
        MOV AL,04H
        MOV DX,FFE4H
        OUT DX,AL
        MOV DX,FFE0H
        IN AL,DX
        MOV BL,00H
        MOV BH,00H
        DB 9AH,12H,0BH,00H,0FFH
        JMP L2
CODE ENDS
END

Communication between two Microprocessors using 8255 Interface in 8086

;8086 Interfaced with 8255 PPI and Programmed as Transmitter
OUTPUT 2500AD
.ORG 2000H

DATA SEGMENT
LIST DB AAH,BBH,CCH,DDH,EEH
DATA ENDS

CODE SEGMENT
    ASSUME CS:CODE,DS:DATA
START:
        MOV AX,DATA
        MOV DS,AX
        MOV SI,OFFSET LIST
        MOV CL,05H
        MOV AL,A0H
        MOV DX,FFE6H
        OUT DX,AL
        MOV AL,0DH
        MOV DX,FFE6H
        OUT DX,AL
L1:
        MOV DX,FFE4H
        IN AL,DX
        AND AL,08H
        CMP AL,00H
        JZ L1
        MOV AL,[SI]
        MOV DX,FFE0H
        OUT DX,AL
        INC SI
        DEC CL
        JNZ L1
CODE ENDS
END
;8086 Interfaced with 8255 PPI and Programmed as Receiver
        OUTPUT 2500AD
.ORG 2000H

DATA SEGMENT
DATA ENDS

CODE SEGMENT
    ASSUME CS:CODE,DS:DATA
START:
        MOV AX,DATA
        MOV DS,AX
        MOV SI,OFFSET LIST
        MOV CL,05H
        MOV AL,B0H
        MOV DX,FFE6H
        OUT DX,AL
        MOV AL,09H
        MOV DX,FFE6H
        OUT DX,AL
L1:
        MOV DX,FFE4H
        IN AL,DX
        AND AL,08H
        CMP AL,00H
        JZ L1
L2:
        MOV DX,FFE0H
        IN AL,DX
        MOV [SI],AL
        INC SI
        DEC CL
        JNZ L2
CODE ENDS
END

Wednesday, 21 May 2014

8085 Microprocessor

8085 Microprocessor

  • 8085 microprocessor was introduced by Intel in the year 1976.
  • The 8080 processor was updated with Enable/Disable instruction pins and Interrupt pins to form the 8085 microprocessor.
  • 8085 is an 8-bit microprocessor
  • It is 40 pin dual in line package IC with single + 5V supply
  • Has 8 bit data bus and 16 bit address bus

 
Fig1: 8085 Pin Diagram and Signal Description

As in Fig1, 8085 is a general purpose microprocessor having 40 pins and works on single power supply. To study the pin diagram we group the signals into 7 categories:

1.Power Supply
2.Clock Signals
3.Interrupt Signals
4.Address and Data bus
5.Control and Status signals
6.Serial I/O Port
7.DMA Request Signals

Architecture of 8085 Microprocessor

Fig2: Functional Block Diagram of 8085 Microprocessor.

Accumulator:-It is a 8-bit register which is used to perform arithmetical and logical operation. It stores the output of any operation. It also works as registers for I/O accesses.


Temporary Register:-It is a 8-bit register which is used to hold the data on which the accumulator is computing operation. It is also called as operand register because it provides operands to ALU.

Registers:-These are general purposes registers. Microprocessor consists 6 general purpose registers of 8-bit each named as B,C,D,E,H and L.   Generally theses registers are not used for storing the data permanently. It carries the 8-bits data. These are used only during the execution of the instructions.

These registers can also be used to carry the 16 bits data by making the pair of 2 registers. The valid register pairs available are BC,DE HL. We can not use other pairs except BC,DEand HL. These registers are programmed by user.

ALU:-ALU performs the arithmetic operations and logical operation.

Flag Registers:-It consists of 5 flip flop which changes its status according to the result stored in an accumulator. It is also known as status registers. It is connected to the ALU. There are five flip-flops in the flag register are as follows:
1.Sign(S)
2.Zero(Z)
3.Auxiliary carry(AC)
4.Parity(P)
5.Carry(C)
Instruction registers(IR):-It is a 8-bit register. When an instruction is fetched from memory then it is stored in this register.

Instruction Decoder:- Instruction decoder identifies the instructions. It takes the informations from instruction register and decodes the instruction to be performed.

Program Counter:-It is a 16 bit register used as memory pointer. It stores the memory address of the next instruction to be executed. So we can say that this register is used to sequencing the program. Generally the memory have 16 bit addresses so that it has 16 bit memory.
The program counter is set to 0000H.

Stack Pointer:-It is also a 16 bit register used as memory pointer. It points to the memory location called stack. Generally stack is a reserved portion of memory where information can be stores or taken back together.

Timing and Control Unit:-It provides timing and control signal to the microprocessor to perform the various operation.It has three control signal. It controls all external and internal circuits. It operates with reference to clock signal.It synchronizes all the data transfers.
There are three control signal:
1.ALE-Airthmetic Latch Enable, It provides control signal to synchronize the components of microprocessor.
2.RD- This is active low used for reading operation.
3.WR-This is active low used for writing operation.

There are three status signal used in microprocessor S0, S1 and IO/M. It changes its status according the provided input to these pins.


Serial Input Output Control:-There are two pins in this unit. This unit is used for serial data communication.

Interrupt Unit:-There are 6 interrupt pins in this unit. Generally an external hardware is connected to these pins. These pins provide interrupt signal sent by external hardware to microprocessor and microprocessor sends acknowledgement for receiving the interrupt signal. Generally INTA is used for acknowledgement. 


What is a Microcontroller?



Microcontroller?
  • A microcontroller (abbreviated µC, uC or MCU) is a small computer on a single integrated circuit
  • It has a processor core, memory, and programmable input/output peripherals.
  • Microcontrollers are dedicated to one task and run one specific program continuously.
  • The program is stored in ROM(read-only memory) and generally does not change.
  • Microcontrollers are "embedded" inside some other device (often a consumer product) so that they can control the features or actions of the product
  • Another name for a microcontroller, is "embedded controller."

  • A typical low-end microcontroller chip might have 1,000 bytes of ROM and 20 bytes of RAM on the chip,along with eight I/0 pins
  • With a microcontroller, you have one specific task you are trying to accomplish, and low-cost, low-power performance is what is important.