You are on page 1of 4

Interfacing Digital-To-Analog converter to 8086 using 8255

1. 2. 3. 4.

Assembly Language Program to generate Square Wave Assembly Language Program to generate Ramp Wave Assembly Language Program to generate Triangular Wave Assembly Language Program to generate Staircase Wave

AIM:To Interface Digital -to-Analog converter to 8086 using 8255 and write Assembly Language Program to generate Square Wave, Ramp Wave, Triangular Wave & Staircase Wave form. APPARATUS:Microprocessor trainer kit, ADC kit, power supply, data cable, CRO etc THEORY:The DAC 0800 is a monolithic 8 bit high speed current output digital to analog converters featuring setting time of 100nSEC. It also features high compliance complementary current outputs to allow differential output voltage of 20 Vp-p with simple resistor load and it can be operated both in unipolar and bipolar mode. FEATURES:1. 2. 3. 4. 5. 6. Fast setting output current 100nS Full scale error +/- 1 LSB Complementary current outputs easy interface to all microprocessor Wide power supply range +/- 4.5 to +/- 18V low power consumption

WORKING:When chip select of DAC is enabled then DAC will convert digital input value given through portliness PB0-PB7 to analog value. The analog output from DAC is a current quantity. This current is converted to voltage using OPAMP based current-tovoltage converter. The voltage outputs (+/- 5V for bipolar 0 to 5V for unipolar mode) of OPAMP are connected to CRO to see the wave form.

; RAMP WAVE GENERATOR with 8086 using 8255 MODEL SMALL .STACK 100 .DATA CONTROL EQU 0FFC6H ; Control port address for 8255 PORTA EQU 0FFC0H ; Port A address for 8255 PORTB EQU 0FFC2H ; Port B address for 8255 PORTC EQU 0FFC4H ; Port C address for 8255 .CODE START: MOV AX,@DATA ;Initialize Data segment MOV DS,AX MOV DX,CONTROL MOV AL,80H ;Initialize all ports as output OUT DX,AL ;Ports MOV BL,FFH ;Take FFH in BL analog equivalent to 5V RAMP : MOV DX,PORTB MOV AL,BL ;Copy to AL OUT DX,AL ;And output it on the port DEC BL ; To generate ramp wave this 5V is continuously decreased till 0V JNZ RAMP ; Jump to RAMP if not 0 MOV BL,FFH ; To generate same wave this procedure is repeated JMP RAMP INT 03H END START ;SQUARE WAVE GENERATOR with 8086 using 8255 MODEL SMALL .STACK 100 .DATA CONTROL EQU 0FFC6H ; Control port address for 8255 PORTA EQU 0FFC0H ; Port A address for 8255 PORTB EQU 0FFC2H ; Port B address for 8255 PORTC EQU 0FFC4H ; Port C address for 8255 .CODE START: MOV DX,CONTROL MOV AL,80H ; Initialize all ports as output OUT DX,AL ; Ports UP: MOV DX,PORTB MOV AL,00H ;Output 00 for 0V level CALL OUTPUT MOV AL,0FFH ;Output FF for 5V level CALL OUTPUT JMP UP

OUTPUT: OUT DX,AL CALL DELAY INT 21H DELAY: MOV CX,0FFH ; To vary through frequency alter the delay count LUP1 LOOP LUP1 INT 21H END START

;TRIANGULAR WAVE GENERATOR with 8086 using 8255 MODEL SMALL .STACK 100 .DATA CONTROL EQU 0FFC6H ; Control port address for 8255 PORTA EQU 0FFC0H ; Port A address for 8255 PORTB EQU 0FFC2H ; Port B address for 8255 PORTC EQU 0FFC4H ; Port C address for 8255 .CODE START: MOV DX,CONTROL MOV AL,80H ; Initialize all ports as output OUT DX,AL ; Ports BEGIN: MOV DX,PORTB MOV AL,00H ; Output 00 for 0V level UP: CALL OUTPUT INC AL ; To raise wave from 0V to 5V increment AL CMP AL,00H JNZ UP ; Jump UP till rising edge is reached i.e. 5V MOV AL,0FFH UP1: CALL OUTPUT DEC AL ; To fall wave from 5V to 0V decrement AL CMP AL,0FFH JNZ UP1 ; Jump UP till falling edge is reached i.e. 0V JMP BEGIN OUTPUT: OUT DX,AL CALL DELAY INT 21H DELAY:

MOV CX,07H ;To vary the frequency alter the delay count LUP1:LOOP LUP1 INT 21H END START ;STAIRCASE WAVEFORM GENERATOR with 8086 using 8255 MODEL SMALL .STACK 100 .DATA CONTROL EQU 0FFC6H ; Control port address for 8255 PORTA EQU 0FFC0H ; Port A address for 8255 PORTB EQU 0FFC2H ; Port B address for 8255 PORTC EQU 0FFC4H ; Port C address for 8255 .CODE START: MOV DX,CONTROL MOV AL,80H ;Initialize all ports as output OUT DX,AL ;Ports UP: MOV DX,PORTB MOV AL,00H ;Output 00 for 0V level CALL OUTPUT ; And wait for some time MOV AL,0FFH ;Output FF for 5V level CALL OUTPUT ; And wait for some time MOV AL,07FH ;Output 7F for 2.5V level CALL OUTPUT ; And wait for some time JMP UP OUTPUT: OUT DX,AL MOV CX,FFH DELAY: LOOP DELAY ; To add DELAY INT 03H END START PROCEDURE:1. Connect power supply 5V & GND to both microprocessor trainer kit & DAC interfacing kit. 2. Connect data bus between microprocessor trainer kit & DAC interfacing kit. 3. Enter the program to generate Ramp, Square, Triangular & Staircase Wave. 4. Execute the program by typing GO E000:4770 ENTER for Ramp, GO E000:03A0 ENTER for Square, GO E000:0410 ENTER for Triangular, GO E000:4890 ENTER for Staircase. 5. Observe the wave forms on CRO.