You are on page 1of 4

Experiment 3

This lab session is divided into two sections and both sections are due to be completed in a single lab session. For the first session roll numbers 1-12 or 25-36 will do section A, and roll numbers 1324 or 37-48 will do section B. After completion, students will swap the lab works. Initial report must include the programs for each of the given problems along with the opcodes and any 8255 control words used in the program must have a derivation. Come prepared with this lab manual and initial report.

Section A ADC (Analog to Digital Converter) Interfacing


Introduction:The microprocessor can handle digital data whereas most of the physical signals are analog in nature. So in many microprocessors based systems, analog input signals have to be converted into digital values. The ADC chip is used for that purpose, to accept analog signals and provide the corresponding digital output. In our lab, there is a 16 channel, 8 bit A/D converter interface module which contains ADC0816 for analog to digital conversion. As there are 16 channels in ADC 0816, there are 4 lines to select any particular channel. These channel select lines are connected to 4 lines of Port A (of the 8255 on the 8085 trainer) viz. PA3, PA2, PA1 and PA0. Some examples of channel selection are given as: PA3 PA2 PA1 PA0 Channel Select 0 0 0 0 0 0 0 1 0 2 0 1 0 0 4 1 0 0 0 8 1 1 0 0 12 1 1 1 1 15 The data from ADC can be read through Port B. START command can be issued to the ADC by asserting PA5.The EOC (end of conversion) can be read through PC0. If continuous A/D conversion is desired, the EOC signal from the ADC can be utilized to issue other start command. To implement this PC4 (RPTCTRL) must be asserted and PA5 de-asserted. The READ signal should be asserted via PA6 to read the digital data from ADC. Installation:The interface module has a 26-pin connector at one edge of the card. This is used for connecting the interface to the trainer with a flat cable connector set. The module is connected to J2 of the trainer. If on board Vcc and reference voltage is required, connect +12 V & GND to the connector J2. When we use external + 12 V Power supply, then the following jumpers must be installed JPI - > B and JP2 -> B If +5V from the trainer is being used (via connector J1, pin 25) for on board Vcc and reference voltage and no external +12V is being used, the following jumpers must be installed JP1-> A and JP2-> A Apply power to the system. Apply power to the interface if a separate power supply is being used for it. Ensure that the reference voltage is 5V. Adjust the pointer on the interface board, if necessary

Sample Program:Connect external 8255 study card and ADC module with 8085 microprocessor trainer kit. Give analog signal to input channel no. 0 of ADC. Run the following program and observe the equivalent digital data in output ports of 8255 study card and stored data on 8085 microprocessor trainer kit. LXI H, 9000H MVI D, 00H MVI A, 80H OUT 83H MVI A, 8BH OUT 43H MOV A, D OUT 40H ORI 20H OUT 40H NOP NOP MOV A, D OUT 40H wait_eoc0: IN 42H ANI 01H ; check EOC JNZ wait_eoc0 wait_eoc1: IN 42H ANI 01H ; check EOC JZ wait_eoc1 MOV A, D ORI 40H OUT 40H ; Assert READ NOP IN 41H ; Read Data OUT 80H MOV M, A MOV A, D OUT 40 ; Disable READ RST 5

; channel no ; Initializing ; output ports ; configure ; 8255 ; load channel no

; start SC signal

; Disable SC

Problems: 1. Run above program by changing input signal voltage and observe digital data in the output port and the memory.

2. Modify above program to continuously display the corresponding equivalent digital value of the signal in channel 0 and 1 (or any other channel no.s) in output ports A and B of the external 8255 respectively. 3. Again modify the program to store 20 digital samples of the input signal in memory address 9000H onwards and observe it.

Section B
DAC (Digital to Analog Converter) Interfacing
Introduction:The DAC interface consists of two 8 bit DAC0800 which can be used to generate different interfacing waveforms using microprocessor. The digital inputs to these DACs are provided through the Port A and Port B of on board 8255 used as output ports. The analog outputs from the DACs are given to operational amplifiers which act as current to voltage converters. Two 10Kohms pots are provided for the offset balancing of op-amps. The outputs from the DACs vary between 0 to 5V corresponding to values between 00 to FF. Different waveforms can be observed at the op-amp outputs depending upon the digital patterns. The outputs waveforms can be observed from Xout and Yout on an oscilloscope. Installation: The interface module has a 26-pin connector which is used for connecting the interface to the microprocessor trainer kit with a flat cable connector set. External power supplies +12V and -12V and GND are connected to point marked +12V and -12V and GND respectively on DAC card through the 4 pin connector provided on the interface. The interface is connected over J2 of the trainer.

Sample Program:Run the following program and observe the output at oscilloscope MVI OUT XRA OUT OUT INR CPI JNZ OUT OUT DCR JNZ JMP A, 80H 43H A 40H 41H A FF L1 40H 41H A L2 L1 ; Initialization of 8255A

L1:

; out to DAC 1 ; out to DAC2

L2:

Calculate peak to peak voltage and frequency of generated waveform. Problems:1. Write an assembly language program to generate the following waveforms a. Square wave

b. Triangular wave c. Sine wave 2. How can you generate the above waveforms with different frequency in the program? Hint for 1.c) The sine wave can be generated by the expression: Bin = 128 + 127 sin x The binary value should be provided at certain interval. The smoothness of the sine wave depends upon the number of sample inputs per cycle and resolution of the DAC. Here resolution of DAC is fixed. So the smoothness of the sine wave depends on number of sample inputs per cycle in some extent. Let us divide a complete cycle by n equal size, and then the binary input at certain interval can be calculated by: Bin = 128 + 127 sin(i*360/n) for i=0 to n, where i is integer Only the magnitude of sine wave in the range 0 to /2 is sufficient to calculate the value in all the range of sine wave. Hence lookup table of range 0 to /2 is sufficient. Bin = 128 + 127 sin (i*360/n) for i=0 to n/4 For n=12 (i.e. 30 samples per cycle) i Angle= i*360/n Bin Hex i Angle= i*360/n Bin Hex 0 0 128 7F 7 210 .. .. 1 30 193 BF 8 240 .. .. 2 60 237 EE 9 270 .. .. 3 90 255 FF 10 300 .. .. 4 120 237 EE 11 330 .. .. 5 150 193 BF 12 360 128 7F 6 180 128 7F .. Hex Value should be stored in the memory and passed into output port on regular interval as DAC input to get sine wave.

You might also like