Google

Jan 17, 2008

Interfacing Digital-To-Analog converter to 8086 using 8255


  1. Assembly Language Program to generate Square Wave
  2. Assembly Language Program to generate Ramp Wave
  3. Assembly Language Program to generate Triangular Wave
  4. 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. Fast setting output current 100nS
  2. Full scale error +/- 1 LSB
  3. Complementary current outputs
  4. easy interface to all microprocessor
  5. Wide power supply range +/- 4.5 to +/- 18V
  6. 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-to-voltage 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.
You might be also interested in:
:: Temperature Control system using 8086
:: Traffic light control system using 8086
:: Assembly Language Program to serve NMI

7 comments:

Pramod said...

fristly thanks,this code clear all
concept about interfacing.......

basavesh said...
This comment has been removed by the author.
basavesh said...

can u please help us in the project "function generator using 8086 microprocessor"..
the abstract is Function generators are one of the important testing equipment in the field electronics. In the early days function generators are made of analog devices, which are inherent with drifts and noises. On the other hand digital function generators are higher in precision accuracy.
In this project it is proposed to construct, the function generator using 8086 microprocessor. It generator Sine, Ramp, Square Triangular waves a signals of varied frequencies. A typical digital function generator consists of microprocessor motherboard and DAC board. The 8086 microprocessor generator a digital signal which is converted to analog by the DAC. The analog output can be viewed on a CRO.

deep said...

can anyone tell that how we can interface the Digital to analog converter with an Pic 16F877A micro controller and also can anyone suggest how to write the code for it.......

npeducations said...

Thank for the code! its really helpful. very clean and neat explanation

SUNNY BHARGAVA said...

awesome!!! very straight forward...

Unknown said...

Staircase wave by 8051 code please