Professional Documents
Culture Documents
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.
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
; 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:
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.