6 views

Uploaded by Eric Yang

1234

- L13_2_f10
- precision DACs
- 5264251
- Unit8-SDG
- pipelined-multistep-adc
- ECX4236_TMA2_2016_A4_New
- 05236133
- BF Rail DIO 1000 User Guide 1
- 2262
- BTEC HNC - Science - Investigate Information and Energy Control Systems
- Eel 3923 c Spring 2018 Syl
- Sample Lab Report
- DIO_1000-v5.01
- Mdaq Analg Demo AN2 Mfd
- Pi Scratch User Manual v213
- Interfacing ADC to 8051. Circuit for Interfacing ADC 0804 to AT89S51 Microcontroller
- Digital Thermometer
- LM139X_5
- Led 22xz11f Sm Diagram
- Fresh Tech1

You are on page 1of 7

L A B

M A N U A L

Experiment

Objective

The aim of this lab experiment is to study the Analog to Digital conversion and Digital to Analog conversion.

Equipment

Flight 8086 training board, Application board, PC with Flight86 software, download cable.

Tasks to be Performed

Simulation of a A/D conversion employing successive approximation method using D/A converter Use a D/A converter to perform the following:

1. Sine wave generation (using look up table) 2. Staircase waveform generation 3. Saw-tooth waveform generation

Read the DIL switches and output the digital values to the LEDs and DAC. The analog output of the DAC is to be represented by lighting up the bargraph.

47

C O E 3 0 5

L A B

M A N U A L

4.1 Background

In any computer controlled process it may be required to monitor analog values, i.e. the output of a voltmeter or strain gauge. In order to do this, the analog signal must be first converted into a digital value using an Analog-to-Digital Converter (A/D). On the other hand, Digital-to-Analog Converters (D/A) can be used to convert a digital output from the computer into an analog value. For instance, we could generate a series of tones by changing the digital output values in such a way that the analog signal is represented as a sine wave.

The Application Board provides four sources of analog inputs which can be selected using a four position switch (SW3). The analog source can be provided externally (P2in), or from the output of a light dependent resistor (LDR1), or from the temperature sensor (Q1), or from an on board variable voltage (UR6). With the Application Board we can simulate a simple A/D converter that reads the output of a certain analog source (e.g. variable voltage) and converts it into a digital value as shown in Figure 4.1. By means sending values to Port-B, and hence by means of the D/A converter we can generate analog voltages proportional to the digital value we output. If this analog voltage is now compared with the unknown analog voltage, we can gradually adjust the output value to Port-A, until the comparator finds the two analog voltages equal. The digital value output to the D/A converter must be the digital value equivalent of the unknown analog input. The output of the comparator is bit 3 of the input Port-B. A logic 1 means the output on Port-B is too small, a logic 0 means it is too large.

48

C O E 3 0 5

L A B

M A N U A L

Example 4.1: Write a program to simulate a simple A/D converter. Use the variable voltage source (UR6) as your analog source. The program should display one HEX digit (0-F) representing the digital value of the voltage input.

Set SW3 to VOLTS (Variable Voltage) Set SW4-2 to DAC (enable D/A converter) Set SW2-2, SW4-1, SW4-3, and SW4-4 OFF 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 COMSEG SEGMENT BYTE PUBLIC 'CODE' ASSUME CS:COMSEG, DS:COMSEG, ES:COMSEG, SS:COMSEG ORG 0100h Start: MOV AL, 99h ; initialize the 8255 PPI chip OUT 06h, AL ; A input, B output, C input MOV AL, 0 OUT 02h, AL ANAL: MOV BL, 0 SMALL: MOV AL, BL OUT 02h, AL NOP NOP NOP NOP NOP NOP IN AL, 00h AND AL, 08h JZ LARGE ; turn off all LEDs ; first digital value ; put in AL for output ; output value to D/A ; wait for D/A

; get input Port-B ; keep comparator bit (bit 3) ; ; ; ; if value is large (bit3= 0) then display the digital value else increment the digital value and tray again

; display the digital value as a HEX digit LARGE: MOV AL, BL CALL display_voltage JMP ANAL INCLUDE display_voltage.asm INCLUDE putc.asm COMSEG ENDS END start

49

C O E 3 0 5

L A B

M A N U A L

The previous code uses two functions, namely display_voltage and putc, to display the digital value corresponding to the input voltage. The first function converts the digital (binary) value of the input voltage into an ASCII character, and calls putc to display it on the screen. The two functions are given in two separate files display_voltage.asm and putc.asm, so that you can include these two files in your code using the INCLUDE directive.

The D/A converter on the Application Board produces an analog voltage proportional to the digital input. The digital input is provided by Port-A. The analog output corresponding to 00h is 0.00V, while the analog output corresponding to the digital input FFh (255) is approximately 2.55V. The following example shows you how to generate a SIN wave using the D/A converter. Example 4.2: Using a set of SIN tables for data, output a sine wave in 10 degree steps, observe the analog output (at P2-Out) with an oscilloscope and measure its frequency. The first step is to construct a table containing the values of the SIN function for the following degrees: 0, 10, 20, , 350 (see Table 4.1). Then, we assign a proper voltage to each value in the SIN table. As you know, the D/A converter can produce 256 different analog voltages (0.00V to 2.55V). Therefore, we can map a range of these voltages to the range of the SIN function (-1 to 1). Let us use the range 0.00V to 2.54V, such that 0.00V corresponds to -1 and 2.54V corresponds to 1. Since 1.27V is the mid point in the range 0.00V to 2.54V, it will be mapped to the mid point of the SIN range which is 0. Other voltage values can be mapped easily to the SIN values as shown in Table 4.1. Finally, we use the digital values corresponding to these analog voltages to generate the SIN wave as shown in the following program.

Set SW4-2 to DAC (enable D/A converter) Set SW2-1 to SWITCH Set SW4-1, SW4-3, and SW4-4 OFF 1 2 3 4 5 6 COMSEG SEGMENT BYTE PUBLIC 'CODE' ASSUME CS:COMSEG, DS:COMSEG, ES:COMSEG, SS:COMSEG ORG 0100h Start: MOV AL, 99h ; initialize the 8255 PPI chip OUT 06h, AL ; A input, B output, C input

50

C O E 3 0 5

L A B

M A N U A L

MOV AL, 0 ; turn off all LEDs OUT 02h, AL MOV SI, OFFSET Table ; 1st element in the table MOV BL, 36 ; number of elements in the table LODSB ; load AL from the table OUT 02h, AL; and output the value to D/A DEC BL JZ L2 JMP L1 DB 127 DB 149 DB 170 DB 191 DB 209 DB 224 DB 237 DB 246 DB 252 DB 254 DB 252 DB 246 DB 237 DB 224 DB 209 DB 191 DB 170 DB 149 DB 127 DB 105 DB 84 DB 64 DB 45 DB 30 DB 17 DB 8 DB 2 DB 0 DB 2 DB 8 DB 17 DB 30 DB 45 DB 64 DB 84 DB 105 COMSEG ENDS END start ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; count down table loop if not zero if zero then return to the start of the table 1.27V 1.49V 1.70V 1.91V 2.09V 2.24V 2.37V 2.46V 2.52V 2.54V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V 1.27V -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> sin(0) sin(10) sin(20) sin(30) sin(40) sin(50) sin(60) sin(70) sin(80) sin(90) sin(100) sin(110) sin(120) sin(130) sin(140) sin(150) sin(160) sin(170) sin(180) sin(190) sin(200) sin(210) sin(220) sin(230) sin(240) sin(250) sin(260) sin(270) sin(280) sin(290) sin(300) sin(310) sin(320) sin(330) sin(340) sin(350)

51

C O E 3 0 5

L A B

M A N U A L

This program reads the digital values form Table and output them to Port-A, then the D/A converter converts them to the corresponding analog voltages. Notice that the values in Table can generate only one cycle of the SIN wave. Therefore, the digital values in Table are output continuously to the D/A converter to generate a continuous SIN wave. Table 4.1: SIN Table

Degree 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 SIN(Degree) 0.000 0.174 0.342 0.500 0.643 0.766 0.866 0.940 0.985 1.000 0.985 0.940 0.866 0.766 0.643 0.500 0.342 0.174 0.000 -0.174 -0.342 -0.500 -0.643 -0.766 -0.866 -0.940 -0.985 -1.000 -0.985 -0.940 -0.866 -0.766 -0.643 -0.500 -0.342 -0.174 Assigned Voltage 1.27 1.49 1.70 1.91 2.09 2.24 2.37 2.46 2.52 2.54 2.52 2.46 2.37 2.24 2.09 1.91 1.70 1.49 1.27 1.05 0.84 0.64 0.45 0.30 0.17 0.08 0.02 0.00 0.02 0.08 0.17 0.30 0.45 0.63 0.84 1.05 Corresponding Digital Value 127 149 170 191 209 224 237 246 252 254 252 246 237 224 209 191 170 149 127 105 84 64 45 30 17 8 2 0 2 8 17 30 45 64 84 105

52

C O E 3 0 5

L A B

M A N U A L

Exercises

6.1.

Consider Example 4.1. Describe how you would minimize the number of digital values required to find the unknown voltage. How could you vary the frequency of the SIN wave generated in Example4.2? Use the D/A converter to perform the following: a. Staircase waveform generation b. Saw-tooth waveform generation

6.2.

6.3.

6.4.

The bar-graph (U10) is essentially a bank of 10 LEDs. It is driven by U11 (LM3914) which samples a voltage input signal, as the signal exceeds certain preset levels it will output a signal to light one of the LEDs on the bargraph. Hence, as the voltage increases, more LEDs will be turned on. a. Write a program to read the DIL switches and output the digital values to the LEDs and DAC. The analog output of the DAC is to be represented by lighting up the bar-graph. b. Plot a graph of switch digital value against the number of LEDs alight on the bar-graph.

53

- L13_2_f10Uploaded bykitamiel
- precision DACsUploaded bywildmonkey88
- 5264251Uploaded byĐăng Khoa Trang
- Unit8-SDGUploaded byvishwanath c
- pipelined-multistep-adcUploaded byamiteshtripathi
- ECX4236_TMA2_2016_A4_NewUploaded byMalith Madhushanka Kodituwakku
- 05236133Uploaded byAl Mtdrs
- BF Rail DIO 1000 User Guide 1Uploaded bydvham
- 2262Uploaded byPrafull B
- BTEC HNC - Science - Investigate Information and Energy Control SystemsUploaded byBrendan Burr
- Eel 3923 c Spring 2018 SylUploaded byRosemond Fabien
- Sample Lab ReportUploaded byzakariansu
- DIO_1000-v5.01Uploaded byittsa
- Mdaq Analg Demo AN2 MfdUploaded byMOHAMED IBRAHIM
- Pi Scratch User Manual v213Uploaded byLoreno A Jr
- Interfacing ADC to 8051. Circuit for Interfacing ADC 0804 to AT89S51 MicrocontrollerUploaded bydanitranoster8512
- Digital ThermometerUploaded byshahpatel19
- LM139X_5Uploaded byiuliuerdelyi
- Led 22xz11f Sm DiagramUploaded byFranco Evale Yumul
- Fresh Tech1Uploaded bySriharsha_Sant_8531
- GATE- IN 2002Uploaded byprabhjot singh1
- Speech CodingUploaded byEsparsh Rathore
- data aqu sysUploaded byNishanth Ravi
- 06905869_002Uploaded byMANEESHA M S
- ADC Stm32f1Uploaded bysabrine
- ADJD_S371_QR999Uploaded byejmelchiors
- L400 Discrete TimeComp 2UPUploaded byVan Nguyen Huu Van
- ProjectUploaded bynaman_bhakta
- Q6xDA_-_User's_Manual_SH(NA)-080054-S_(05.15)Uploaded byMuhammad Surya Sulila
- code (1).txtUploaded byMUHAMMAD DANISH BASHIR

- Integration FormulasUploaded byJoyen Sanjana
- MittyUploaded byEric Yang
- diffformUploaded bymrignal
- Copy (2) of Mitty2Uploaded byEric Yang
- Problems and Solutions in ElectronicsUploaded byvidya_sagar826
- 123546549798Uploaded byJharey Japon Reynosa
- E-gizmo Product CatalogUploaded byMark Badua
- 18746847 Piano Sheet One Piece Binks No SakeUploaded byertwertwertwertwertwert
- Alexan Prodlist2012Uploaded byEric Yang
- chapter8.pdfUploaded byJharey Japon Reynosa
- f818Uploaded byEric Yang
- Microcontrollers WorkUploaded byEric Yang
- Lab4Uploaded byEric Yang

- RTVM 2015Uploaded byWannys ELy's
- ec01Uploaded byArchit Verma
- Udms Mca SyllabusUploaded bydatta
- Logic IntroductionUploaded by陳鍾誠
- Sloshing Ship Motion Coupling EffectUploaded bySafal Banker
- Art 21Uploaded byJlrey
- Aplplication of Traditional Games in Mathematics Learning Kindergarten (Fix)Uploaded byFajar Tri Setiawan
- Ch 3 Acids and Bases Equation WritingUploaded bytanhuikuan
- The Theory of Explosion Induced Damage Ship Whipping Motions.pdfUploaded byFernando Raúl LADINO
- SOAL.docxUploaded byFebryn Ngk
- c11Uploaded bykshyam
- EE ProUploaded byBradley Rossignol
- Chapter 04 statisticsUploaded byVishal Kumar
- New Energy Technologies Issue 09Uploaded byblameitontherain9877
- Gyro NotesUploaded byManupriya Chauhan
- differentiationUploaded byMohamed Mohsen
- f.txtUploaded byEsther Arenas Yataco
- hw6Uploaded bymelankolia370
- Formal Write-Up FinalUploaded byGustavo
- Chapter 9Uploaded bynikowawa
- 1809.10160.pdfUploaded byFábio Duarte
- Determination of the Thermodynamic Properties of Refrigerant-OilUploaded bysalamrefigh
- UN Handbook on Designing Household Survey SamplesUploaded byssajith123
- Centroids-of-Composite-Bodies.pdfUploaded byบิ๊ก บิ๊ก
- Wicked Problems - Structuring Social Messes with Morphological AnalysisUploaded byritchey9363
- E02Uploaded byVirendra Kumar Pareek
- Process Control and Instrumentation Sec5-7Uploaded byJayvee Francisco
- ACE 12Mg2YE 2016 Exagrgrgm PaperUploaded byBrendan Rong
- parallel perpendicular alg1Uploaded byapi-167924086
- geometry section 2 6Uploaded byapi-262621710