Thursday, 24 April 2014

Write 8086 ALP to convert an analog signal in the range of 0V to 5V to its corresponding digital signal.

Department of Computer Engineering
ALP Sheet for Microprocessor Interfacing Laboratory
Tiltle: Write 8086 ALP to convert an analog signal in the range of 0V to 5V to its corresponding digital signal.
Assembly Language Program:
Address (CS:IP)
Label
Instruction
Remark
0000:1000
START:
MOV AL,99
; Initialise 8255 (10011001B: Port A and  Port C input & Port B output)
0000:1002

OUT 67,AL
; Send it to control word
0000:1004
AGAIN:
MOV AL,07
; Initialise OSC, OE & SOC (00000111B)
0000:1006

OUT 63,AL
; Send it to Port B
0000:1008

MOV AL,06
; -VE going pulse to SOC (00000110B)
0000:100A

OUT 63,AL
; Send it to Port B
0000:100C
UP1:
IN AL,65
; Reading EOC
0000:100E

AND AL,01
; Check PC-0 = 1
0000:1010

JZ UP1
; If not read Port - C again
0000:1012

MOV AL,04
; Send OE signal (00000100B)
0000:1014

OUT 63,AL
; Send it to Port B
0000:1016

IN AL,61
; Read digital data through Port A
0000:1018

CALL F000:0D5E
; Display result
0000:101D

JMP AGAIN
; Repeat the process again






















Assignment 8
Group B
Aim: Write 8086 ALP to convert an analog signal in the range of 0V to 5V to its corresponding digital signal using successive approximation ADC and dual slope ADC. Find resolution used in both the ADC's and compare the results.

Apparatus: Dynalog 8086 kit, Dynalog ADC Card and Regulated DC power supply (0 to min 5V), Interfacing Cables, SMPS.

Theory:
Successive Approximation ADC: A successive approximation ADC is a type of analog-to-digital converter that converts a continuous analog waveform into a discrete digital representation via a binary search through all possible quantization levels before finally converging upon a digital output for each conversion.


The successive approximation Analog to digital converter circuit typically consists of four chief subcircuits:
  1. A sample and hold circuit to acquire the input voltage (Vin).
  2. An analog voltage comparator that compares Vin to the output of the internal DAC and outputs the result of the comparison to the successive approximation register (SAR).
  3. A successive approximation register subcircuit designed to supply an approximate digital code of Vin to the internal DAC.
  4. An internal reference DAC that supplies the comparator with an analog voltage equivalent of the digital code output of the SAR for comparison with Vin.
The ADC 0809: The ADC0808/ADC0809 data acquisition component is a monolithic CMOS device with an 8-bit analog-to-digital converter, 8-channel multiplexer and microprocessor compatible control logic. The 8-bit A/D converter uses successive approximation as the conversion technique. The converter features a high impedance chopper stabilized comparator, a 256R voltage divider with analog switch tree and a successive approximation register. The 8-channel multiplexer can directly access any of 8-single-ended analog signals.
The device eliminates the need for external zero and full-scale adjustments. Easy interfacing to microprocessors is provided by the latched and decoded multiplexer address inputs and latched TTL TRI-STATE outputs.
Features of 8255:
•          24 Programmable I/O Pins,
•          Widely used programmable parallel I/O device,
•          Interfaces peripheral components to the system bus through its three 8-bit ports,
•          Fully TTL compatible,
•          Direct Bit Set/Reset Capability,
•          Enhanced Control Word Read Capability,
•          High Speed, No “Wait State” Operation with 5MHz and 8MHz 80C86 and 80C88

Block Diagram of 8255:




Control Word of 8255:






2. Procedure:
  1. Get machine codes for assembly language program to convert analog input to its digital equivalent.
  2. Connect SMPS to ADC & 8086 kit.
  3. Connect analog input from regulated power supply to ADC.
  4. Connect ADC card to 8086 kit using 26 pin FRC, through J2 (Used for U7- 8255 IC)
  5. Keeping analog input to zero switch-on regulated power supply & SMPS.
  6. Enter machine codes starting from 0000:0100 location.
  7. Keep analog input in between 0 Vdc to 5 Vdc and Execute the program,
  8. Check the contents of AL register to get digital equivalent of analog input,
  9. Take readings for different analog inputs.

3. Working of ADC Card:
  1. We are using U7- 8255 IC to interface ADC kit (For U7 8255 IC Addresses are : 61-Port A 63-Port B, 65- Port C, 67- Control Register)
  2. Port A & C are used as input ports and port B as output port.
  3. Port A is connected to DATA lines of ADC, PC0 is connected to receive EOC signal from ADC and PB0- is connected to SOC, PB1 is connected through inverting NAND gate to OE & PB2 is connected to OSC enable pin,
  4. Initialise 8255 using control word (99- to set PA,PC as input port, PB as output port and all ports in MODE 0)
  5. Initialise ADC by sending OSC, OE & SOC high (07) using PB
  6. To start the conversion send High to low going pulse on SOC i.e. by sending 06 using PB,
  7. Read the status of PC and check the EOC bit (PC0)
  8. Once the PC0 is high send low on PB1(OE) to enable output i.e. 04 using PB,
  9. Read the digital data on data lines of ADC using PA in AL register and Display on LCD screen.
  10. Repeat from step 5 till reset.
             
4. Algorithms for program
  1. Initialise U7- 8255 with CW 99h
  2. Initialise ADC with OSC, OE & SOC high (07h),
  3. Send SOC negative going pulse (06h),
  4. Read port C to check EOC,
  5. If no repeat step-4 & if yes make PB1 low (04h) to send OE signal to ADC,
  6. Read digital data on data lines of ADC using PA and Display repeat from ‘step ii’.
  7. STOP

Observation Table:

Sr. No.
Analog Input(Volts)
Digital Output (Hex)
1
0.0

2
0.5

3
1.0

4
1.5

5
2.0

6
2.5

7
3.0

8
3.5

9
4.0

10
4.5

11
5.0



Conclusion: Hence we have performed the practical to convert the analog signal to digital using Dyna86 kit and ADC card.

No comments:

Post a Comment