Interfacing ADC and DAC to 8086.

1.Digital to Anolog converter.

 

Aim:

Program to generate following wave forms
    a. Ramp waveform
    b. Square waveform
    c. Step waveform
    d. Triangle waveform

Apparatus:

1. ADS-SDA-86-STA kit
2. 8255 Study card
3. Adapter, Keyboard, Cables, CRO Etc...

Procedure:

1. Connect 8086 kit PC using RS232 cable.
2. Connect Power supply to 8086 kit and 8255 interfacing kit(only blue( 5v) and black(0v) lines   Power cable to power supply)
3. Connect 8255  to CN4 of 8086 using 26  pin bus.
4. Connect the CRO probe to JP3 of 8255 kit
5. Keep the DIP switch in 1 & 7 on (8086kit), open TALK, and go to options select target device as 8086 and Connect.
6. Change dip switch into 1 & 5on, once reset 8086 kit.
7. Go to file →Download hex file 
8. G-5000(on system keyboard), we can observe the output on 8086 kit and CRO.

Program:

Ramp Wave Form Generation

.OUTPUT 2500AD
CONTROL    EQU FFC6H       ;control port address for 8255
PORTA EQU FFC0H    ;porta address for 8255
PORTB EQU FFC2H    ;portb address for 8255
PORTC EQU FFC4H    ;portc address for 8255

DSEG SEGMENT
ORG 0000: 4000H
      MSG    DB' Dac mode    ',0h
      MSG1    DB    'Ramp wave output',0h
      DSEG    ENDS
    
CSEG    SEGMENT
    ORG 0000 : 5000H
    ASSUME CS : CSEG, DS : DSEG
    START:
    MOV DX, CONTROL    
    MOV AL, 80H        ;initialise all ports as output
    OUT DX, AL        ;ports
                        ;displaying message on LCD
    Call far f800 : 4bb1h    ;clear display
    Mov di, 80h    ;display in upper line
    MOV SI, offset MSG    
    CALL FAR f800 : 4FC0h    ;display output routine
    MOV DI, C0H    ;display in lower line
    MOV SI, OFFSET MSG1    
    CALL FAR F800 : 4FC0H    ;display output routine
    ;ramp wave form generation
    MOV BL, 00H        
RAMP: MOV DX, PORTB
    MOV AL, BL    ;increment the digital code
    OUT DX, AL    ;and output it on to PORTB
    INC BL
            ;check to see if a NMI-INTR
    JNZ RAMP

    MOV BL, 00H
    JMP RAMP
CSEGENDS
END
SQUARE WAVEFORM:            
DA00: MOV DX, PORTB
      MOV AL, 00H        ;outport 00 for 0V level
      CALL OUTPUT
      MOV AL, 0FFH        
      CALL OUTPUT        
      JMP DA00
    ;routine to output digital value
OUTPUT: OUT DX, AL
    CALL DELAY
    RET
DELAY: MOV CX,0FFH     ;to vary the frequency alter the delay count
LUP1: LOOP LUP1
      RET
STEP WAVEFORM:
DA00: MOV DX, PORTB
      MOV AL, 00H    ;outport 00 for 0V level
      CALL OUTPUT
      MOV AL, 7FH    ;outport 7F for 2.5V level
      CALL OUTPUT
      MOV AL, FFH    ;outport FF for 5V level
      CALL OUTPUT
            ;look for NMI-INTR if user
     JMP DA00    ;switch to ramp w/f generation

    ;routine to output digital value
    
OUTPUT: OUT DX, AL
    MOV CX, FFH
DELAY: LOOP DELAY
    RET

TRIANGULAR WAVEFORM:
        
DA00: MOV DX, PORTB
      MOV AL, 00H    ;outport 00 for 0V level
UP: CALL OUTPUT
    INC AL
    CMP AL, 00H
    JNZ UP
    MOV AL, 0FFH       ;to change amplitude change count
UP1: CALL OUTPUT
     DEC AL
     CMP AL, 0FFH
     JNZ UP1
     JMP DA00
;routine to output digital value
OUTPUT: OUT DX, AL
    CALL DELAY
    RET
DELAY: MOV CX, 07H    ;to vary the frequency alter the delay count
LUP1: LOOP LUP1
      RET

Step waveform:

 

DA00: MOV DX, PORTB
      MOV AL, 00H    ;outport 00 for 0V level
      CALL OUTPUT
      MOV AL, 7FH    ;outport 7F for 2.5V level
      CALL OUTPUT
      MOV AL, FFH    ;outport FF for 5V level
      CALL OUTPUT
            ;look for NMI-INTR if user
      JMP DA00    ;switch to ramp w/f generation
            ;routine to output digital value
OUTPUT: OUT DX, AL
    MOV CX, FFH
DELAY: LOOP DELAY
       RET

Triangular waveform:

DA00: MOV DX, PORTB
      MOV AL, 00H    ;outport 00 for 0V level
UP: CALL OUTPUT
    INC AL
    CMP AL, 00H
    JNZ UP
    MOV AL, 0FFH       ;to change amplitude change count
UP1: CALL OUTPUT
     DEC AL
     CMP AL, 0FFH
     JNZ UP1    
     JMP DA00
;routine to output digital value
OUTPUT:    OUT DX, AL
    CALL DELAY
        RET
DELAY: MOV CX, 07H    ;to vary the frequency alter the delay count
LUP1: LOOP LUP1
      RET

Result:

The waveforms are generated by interfacing PPI to 8086 kit and observed on CRO.

 

2. Anolog to Digital converter.

Aim:

Write a program in ALP to establish Communication between two processors using 8251.

Apparatus:

1. ADS-SDA-86-STA kit
2. 8255 Study card
3. Adapter, Keyboard, Cables, Connecting Wires Etc...

Procedure:

1. Connect 8086 kit PC using RS232 cable.
2. Connect Power supply to 8086 kit and 8255 interfacing kit(only blue( 5v) and black(0v) lines   Power cable to power supply)
3. Connect 8255 to CN4 of 8086 using 26  pin bus.
4. Keep the DIP switch in 1 & 7 on (8086kit), open TALK, and go to options select target device as 8086 and Connect.
5. Change dip switch into 1 & 5on, once reset 8086 kit.
6. Go to file →Download hex file
7. Keep the DIP switch in 1 & 7 on (8086kit)
8. G-5000(on kit keyboard), ‘ENTER CHANNEL NUMBER” displays on LCD display.
9. Type the channel number on kit keyboard and connect the connecting wire the particular channel and power supplies given to 8255 study card. Now observe the output on the 8086 kit

Program:

.OUTPUT 2500AD
CONTROL    EQU FFC6H    ;control port address for 8255
PORTA EQU FFC0H    ;porta address for 8255
PORTB EQU FFC2H    ;portb address for 8255
PORTC EQU FFC4H    ;portc address for 8255
KWAD EQU F800 : 4EEDH
DBDTA EQUF800 : 4F1FH
DSEG SEGMENT
     ORG 0000 : 4000H
MSG DB            'Enter channel No',0h
DSEG ENDS
CSEG SEGMENT
     ASSUME CS : CSEG, DS : DSEG
     ORG 0000 : 5000H
;displaying message on LCD
     Callfar f800 : 4bb1h    ;clear display
    movdi, 80h    ;display in upper line
    MOV SI, offset MSG    ;
    CALLFAR f800 : 4FC0h    ;display output routine
    MOV AX, 0000H
    MOV DS, AX    
;AD00: CALL FAR KWAD    ;get key for channel selection
    MOV CX, SI
    MOV AL, 90H    ;control word for PPI
    MOV DX, CONTROL
    OUT DX, AL    ;portA->i/p port,portB->o/p port
                ;portC->o/p port.
AD00: MOV AL, CL    ;output channel number
      MOV DX, PORTC
      OUT DX, AL          ;start conversion
      MOV AL, 0FH    ;PC7 (START/ALE) set
      MOV DX, CONTROL
      OUT DX, AL
      PUSH CX
      MOV CX, 3FFFH
DEL1: LOOP DEL1
      POP CX
      MOV AL, 0EH        ;PC7 reset
      MOV DX, CONTROL
      OUT DX, AL    ;look for EOC
      MOV AL, 0CH        ;reset PC6 to read EOC
      OUT DX, AL
AD01: MOV DX, PORTA
      IN AL, DX    ;poll the EOC line which
      AND AL, 80H    ;is connected to PA7 line
      CMP AL, 80H
      JNZ AD01                  ;if EOC (PA7) is high read the digital value otherwise      again check for EOC (PA7) line
      MOV AL, 0DH    ;set OE (PC6) to read value
      MOV DX, CONTROL
      OUT DX, AL  ;before reading data from ADC set PC6 line
      MOV DX, PORTA
      IN AL, DX    ;read digital value
      MOV AH, 00H
      MOV SI, AX
      PUSH CX
      CALL FAR DBDTA    ;display digital value
      POP CX
      JMP AD00
CSEG ENDS
END

Result:

Analog to Digital Conversion using 8255 is studied is Studied And The Output is Verified