DAC interfacing

56
8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE BOARD (Model No :VBMB - 002) Application Manual Version 2.0 Technical Clarification /Suggestion : / Technical Support Division, Vi Microsystems Pvt. Ltd., Plot No :75,Electronics Estate, Perungudi,Chennai - 600 096,INDIA. Ph: 91- 44-2496 1842, 91-44-2496 1852 Mail : [email protected], Web : www.vimicrosystems.com

Transcript of DAC interfacing

Page 1: DAC interfacing

8-BIT DIGITAL TO ANALOGCONVERTER INTERFACE BOARD

(Model No :VBMB - 002)

Application Manual

Version 2.0

Technical Clarification /Suggestion :

/ Technical Support Division,

Vi Microsystems Pvt. Ltd.,Plot No :75,Electronics Estate,

Perungudi,Chennai - 600 096,INDIA.

Ph: 91- 44-2496 1842, 91-44-2496 1852

Mail : [email protected],

Web : www.vimicrosystems.com

Page 2: DAC interfacing

CONTENTS

CHAPTER PAGE No.

1 INTRODUCTION 1

2 BASIC WORKING PRINCIPLE 2

2.1 D/A Converter - Basic working Principle 2

2.2 A/D Conversion Methods 4

2.2.1 A/D Converter - Counter Method

2.2.2 Successive Approximation Technique

3 CIRCUIT IMPLEMENTATION 8

3.1 I/O Decoding 8

3.2 D/A Conversion Circuits 9

3.3 A/D Converter Circuits 10

3.4 Temperature Measurement using

VBMB - 002 and ITB - 005 10

4 SOFTWARE EXAMPLES 11

5 TESTING POINTS 18

Page 3: DAC interfacing

LIST OF APPENDICES

APPENDIX - A Ic Data Sheets ....................................................... 19

APPENDIX - B IC Pinouts ............................................................. 33

APPENDIX - C Circuit Diagram .................................................... 34

APPENDIX - D Component Layout ............................................... 36

APPENDIX - E Software Examples in 8031

Assembly Language .............................................. 38

APPENDIX - F Software Examples in 8086

Assembly Language ............................................. 43

APPENDIX - G Software Examples in 86/88 EB LCD

Assembly Language ............................................ 46

APPENDIX - H Software Examples in 8097

Assembly Language ............................................ 49

APPENDIX - I Suggested Reference............................................ 52

Page 4: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [1 ]

CHAPTER -1INTRODUCTION

In order to control medical instruments or automobiles or the machines inelectronics factory, with a microprocessor based system, we need todetermine the values of physical quantities such as temperature, pressureetc. These are represented by equivalent electrical quantities by meansof transducers. These signals are called analog signals. Even though ananalog signal may represent a real physical parameter with accuracy, it isdifficult to process or store the analog signal for later use withoutintroducing considerable error. Therefore in a microprocessor basedcontrol system, it is necessary to translate an analog signal into digitalsignal and vice versa. The electronic circuit that translates an analog signalinto a digital signal is called an Analog-to-Digital or A/D Converter (ADC).Similarly the circuit that translates digital information to analog signal iscalled Digital-to-Analog converter or D/A Converter (DAC).

VBMB-002 contains two D/A converters using DAC0800. Using this add-oncard you can learn in detail how to interface D/A converters withmicroprocessors. This card also consists of a comparator which can beused along with the D/A converter. Details about this is discussed later.

Page 5: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [2 ]

CHAPTER - 2BASIC WORKING PRINCIPLE

2.1 D/A CONVERTERS - BASIC WORKING PRINCIPLE

Digital-to-Analog converters can be classified as current output, voltageoutput and multiplying type. The current output DAC, provides current asthe output signal. The voltage output DAC internally converters the currentsignal into voltage signal. The voltage output DAC is slower than thecurrent output DAC because of the delay in converting the current signalin to voltage signal. The voltage output DAC is slower than the currentsignal into the voltage signal.

The multiplying DAC is similar to the other 2 types except its outputrepresents the product of input signal and the reference source and theproduct is linear over a board range. Conceptually there is no differencebetween these three types; (i.e) any DAC can be viewed as a multiplyingDAC. DACS specially designed to be compatible with microprocessors areavailable. Our add-on card uses one such DAC 0800, an 8-bit Digital-to-Analog Converter. Typical applications of DACS include digital voltmeters,peak detectors, panel meters, programmable gain and attenuation andstepping motor drive.

Figure-1 shows a simple 3 bit D/A converter. It has 3 digital input lines(D2,D1 and D0) and one output line for the analog signal. The 3 inputsignals can assume 8 combinations from 000 to 111. If the input rangesfrom 0 to 1 V it can be divided into 8 equal parts (1/8V) and eachsuccessive input is 1/8 V higher than the previous combination. Thus if thefull-scale analog voltage is 1V, the smaller unit (LSB) or 001 is equivalentto 1/8 of 1V. The 100 (MSB) represents half of the full-scale value. Formaximum input signal 111, the output signal is equal to the value of thefull-scale input signal minus the value of the 1 LSB. So for a full scalevoltage 1V, it will be 7/8V in the above example.

Page 6: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [3 ]

Input signals representing appropriate binary values can be simulated byan operational amplifier with a summing network as shown in Figure-2. Ifall the inputs are 1, the total current is 0.875 (7/8)mA or the voltage is 7/8V.

One major drawback of the above is the requirement for various precisionresistors. Another method is to employ an R/2R ladder network as shownin fig.3.

Our board VBMB-002 is based on DAC 0800. Internally it consists of anR/2R ladder network. Details about the features of this IC and theinterfacing of DAC with microprocessor is dealt in detail in the followingchapter.

ANALOG OUTPUT

MSB

LSB

DIGITAL I/P

D2

D1

D

DAC

-

+

R1 I12K

R2 4K I2

R3 8K I3

D2

D0

I1 R8 1K

V0

IT = I1+I2+I3

= VIN (1/2 +1/4 +1/8)1K

= 0.875(7/8)mA or 7/8mA

= 0.875(7/8)V or 7/8V

V = IT+Rf0

-

+

POINTSUMMING

V0

D2

R22R

D1

2RR1R0

D0

2R

Rf

Vref

R

(R1')

R

(R2')

R0'(2R)

Page 7: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [4 ]

2.2 A/D CONVERSION METHODS

The A/D conversion is the process in which an analog signal is representedby equivalent binary states. Analog-to Digital converters can be classifiedinto two general groups based on the conversion technique. One techniqueinvolves comparing a given analog signal with the internally generatedequivalent signal. This group involves successive approximation, counterand flash-type converters. The second technique involves changing ananalog signal into time or frequency and comparing these new parametersagainst known values. This group includes integrator converters andvoltage to frequency converters. The trade-off between the two techniquesis based on accuracy Vs speed. The successive approximation and theflash type are faster but generally less accurate than the integrator and thevoltage-to-frequency type converters. Furthermore, the flash type isexpensive and difficult to design for high accuracy.

We will brief our discussion here on counter method and successiveapproximation method. Students are requested to refer to the suggestedreferences in Appendix for more details.

2.2.1. A/D CONVERTER - COUNTER METHOD

A high resolution A/D converter using a single comparator could beconstructed with a variable reference voltage. This reference voltage couldbe applied to the comparator and when it become equals to the analoginput voltage, the conversion would be complete. A counter can be usedto generate the required reference voltage. The counter value isincremented until the DAC output is equal to the measured value. Thecontent of the counter gives the equivalent binary for the measuredvoltage, refer Figure-4.

2.2.2. SUCCESSIVE APPROXIMATION TECHNIQUE

The disadvantage of the counter technique is the difference in time takenfor conversion. When the measured voltage increases conversion becomesslower. Successive approximation technique is much faster. Block diagramfor successive approximation ADC is shown in Figure-4.

Page 8: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [5 ]

Vi

COMPARATOR

DAC

COUNTER

REFERENCEVOLTAGE

8 BITS

8

O/P

COUNTER TYPE A/D CONVERTER

COMPARATOR

DATA READY

VinANALOG

INPUT

Vo

CONTROL

START

(STATUS)

CLK

4 BIT D/A

CONVERTER

SUCCESSIVE

APPROXIMATION

OUTPUT

REGISTER

REGISTER

D0D1D2D3

SUCCESSIVE APPROXIMATION A/D CONVERTER

Page 9: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [6 ]

This method similar to the counter method in that the measured voltage iscompared with an internally generated reference voltage. But the methodof creating the reference voltage is different. In this case for a 4 bit ADCshown in Figure-4, bit D3 is turned on first and the output of the DAC iscompared with an analog signal. If the comparator changes state,indicating that the output generated by D3 is larger than the analog signal,bit D3 is turned off in the SAR and the bit D2 is turned on. The processcontinues until the input reaches bit D0. Figure-5 shows the chain.

Successive approximation process can be accomplished through eithersoftware or hardware approach. In the software approach, an A/Dconverter is designed using a D/A converter and the microprocessor playsthe role of the counter and the SAR.

START

00001000

1100

1110

1111

1101

1111

1110

1100

1101

1010

10011000

101110101001

1011

0100

0110

0010

0111

0101

0011

0001

0111

01100101

0100

0011

00100001

0000

Page 10: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [7 ]

In our VBMB - 002 board we can design DAC0800 IC as shown in belowfigure.

Where as output can be expressed as,

E VX

REF0

256

256

2

256

X = Input code.

R R RL L REF

The output can be obtained from the following inputs,

B1 B2 B3 B4 B5 B6 B7 B8 EO

Positive Full scalePositive full scale-LSB(+) zero scale(-) Zero scaleNegative full scale+LSBNegative full scale

1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 01 0 0 0 0 0 0 00 1 1 1 1 1 1 1

0 0 0 0 0 0 0 10 0 0 0 0 0 0 0

+9.960

+9.880+0.040-0.040

-9.880-9.960

E0

RL

-

+

LM741

RL

4

2Io

Io

DAC0800

5 6 7 8 9 10 11 12

B1 2B B3 B4 B8B7B6B5

REFV

Digital Inputs

MSB LSB

RREF

Page 11: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [8 ]

CHAPTER - 3CIRCUIT IMPLEMENTATION

The basic microprocessor board, VBMB-002, incorporates two 8-bitDigital-to-Analog converters, DAC 0800.

DAC 0800 is a monolithic, high speed, current output Digital to Analogconverter. It's unique features are:

* Typical settling time of 100 Nanoseconds.

* Complementary current outputs.

* Differential output voltages of 20V peak-to-peak with simple resistorloads.

* 2-quadrant wide range multiplying capability.

The DAC interface section comprises of

i. I/O decoding

ii. D/A conversion circuit

3.1 I/O DECODING

The IC's 74LS138 and 74LS00 form the address decoding logic in thisinterface board. The address lines A3, A4 and A5 are tied to pin 1, pin 2and pin 3 of 74LS138 respectively. The address lines A6 and A7 areNANDed together and the NAND gate output is connected to pin 5 of74LS138. Similarly IOW and IOR signals are NANDed and the NANDgate output is connected to pin 6 of 74LS138. (Refer the circuit diagramin Appendix-A). Pin 4 is grounded.

Page 12: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [9 ]

Thus with

DAC 1 is selected, and with

3.2 D/A CONVERSION CIRCUIT

The design comprises of the latch 74LS273, DAC 0800 and the current tovoltage converting circuitry using OP AMP 741. DAC 0800 is configured forbipolar output operation.

IC 74LS273 latches the 8-bit data on the data bus. The data latched by74LS273 is input to DAC 0800. The DAC 0800 converters the 8-bit inputand gives equivalent complementary current outputs.

Current to voltage conversion circuit is designed using OP AMP 741. Thiscircuit converters the current output of DAC 0800 into equivalent analogvoltage. Complementary current outputs Iout, Iout are connected toinverting and non-inverting inputs of OP AMP 741. In order to have theoutput voltage variation from -5 to +5V, a 2.2K feed back resistor has beenselected.

The DAC outputs are available at the 4 pin J801 connector (p1). DAC 1and DAC 2 outputs are terminated at pin 1 and pin 2 respectively. Pin 4 isconnected to the ground.

The circuit diagram with connector pinout details and the component layoutare given at the end of this application note.

1 1 00 X1 XX

A1 A0A3 A2A5 A4A6A7

= C8 (Hex)

1 1 00 X0 XX

A1 A0A3 A2A5 A4A6A7

= C0 (Hex)

Page 13: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [10 ]

3.3 A/D CONVERSION CIRCUIT

As you are now aware it is possible to construct an ADC using DAC if youhave a register (Successive Approximation Register) or a counter and acomparator. We have also mentioned that in the software based A/Dconverter microprocessor can act as a counter or successive provided acomparator LM-311 in our card VBMB-002. The output of DAC channel 1is given to one of the inputs of the comparator. You can given an analogvoltage, between -5 to +5V to be converted to digital forms the other input.Figure-6 illustrates the arrangement in our card.

The comparator’s output goes high when DAC 1 and the analog voltageare approximately equal. To check the buffer (U10) the output of which isconnected to D0 line. The 74125 address is decoded as follows.

3.4 TEMPERATURE MEASUREMENT USING VBMB-002 AND ITB-005

In application of VBMB-002 is temperature measurement using ITB-005 isbasically signal conditioning board with a thermocouple and AD-590module. The AD-590 module gives a voltage from 0V to 5V for a rang of 0to 100°C. For supplying power to ITB-005 board, +12V, -12V and +5V aretaken out and terminated at connector P3 of ITB-002. You can connect thissignal to the ADC input of connector P2 in VBMB-002. By writingappropriate software you can find out the equivalent hex value proportionalto the temperature and display it. Example-6 in the following chapterillustrates this.

-

+

LM311

COMPARATOREXTERNAL

ANALOG74LS125

(I/O ADDRESS D0H)

(TO CPU

DATA BUS)

VOLTAGE

(-5V to +5V)

DAC1

P2

2 3

A

1

D0

1 1 10 00 00

A1 A0A3 A2A5 A4A6A7

= D0H

Page 14: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [11 ]

CHAPTER - 4SOFTWARE EXAMPLES

After going through the software examples you can learn how to control theDAC using 8085 and generate sine wave, sawtooth wave etc by means ofsoftware. Same function can be done by using other microprocessorsalso. This is achieved simply by changing the software for correspondingCPU. The program for other micro processes are listed in the appendices.

4.1 EXAMPLE - 1

AIM To obtain a output of 0 volts at DAC1.

Since DAC 0800 is an 8-bit DAC and the output voltage variation isbetween -5V and +5V. The output voltage varies in steps of 10/256 = 0.04(approx). The digital data input and the corresponding output voltages arepresented in the following table.

Input Data in Hex Output Voltage

000102..

7F...

FDFEFF

-5.00-4.96-4.92

0.00

4.924.965.00

Execute the following program and observe that the output voltage at DAC1 is 0 Volts.

ORG 4100H4100 3E 7F MVI A,7F4102 D3 C0 OUT 0C0H4104 76

Page 15: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [12 ]

4.2 EXAMPLE - 2

AIM

To generate square-wave at the DAC2 output.

The basic idea behind the generation of waveforms is the continuousgeneration of analog output of DAC.

With 00 (Hex) as input to DAC 2, the analog output is -5V. Similarly with FF(Hex) as input the output is +5V. Outputting digital data 00 and FF atregular intervals, to DAC2, results in a square wave of amplitude 15 Volts.

4100 3E 00 START: MVI 4100H4102 D3 C8 OUT 0C8H4104 CD 11 41 CALL DELAY4107 3E FF MVI A, 0FF4109 D3 C8 OUT 0C8H410BCD 11 41 CALL DELAY410EC3 00 41 JMP START4111 06 05 MVI B, 054113 0E FF MVI C,0FF4115 0D DCR C4116 C2 15 41 JNZ L24119 05 DCR B411AC2 13 41 JNZ L1411DC9 RET

Execute the program and using a CRO, verify that the waveform at theDAC2 output is a square-wave. Modify the frequency of the square-wave,by varying the time delay.

Page 16: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [13 ]

4.3 EXAMPLE - 3

AIM

To create a Saw-Tooth wave at the output of DAC-1.

Output digital data from 00 to FF in constant steps of 01 to DAC 1. Repeatthis sequence again and again. As a result a saw-tooth wave will begenerated at DAC1 output.

4100 ORG 4100H4100 START:4100 3E 00 MVI A,00H4102 L1:4102 D3 C0 OUT 0C0H4104 3C INR A4105 C2 02 41 JNZ L14108 C3 00 41 JMP START 4.4 EXAMPLE - 4

AIM

To generate Triangular waveform at DAC-2 output.

The following program will generate a triangular wave at DAC2 output. Theprogram is self explanatory.

4100 ORG 4100H4100 START:4100 2E 00 MVI L,00H4102 L1:4102 7D MOV A,L4103 D3 C8 OUT 0C8H4105 2C INR L4106 C2 02 41 JNZ L14109 2E FF MVI L,0FFH410B L2:410B 7D MOV A,L410C D3 C8 OUT 0C8H410E 2D DCR L410F C2 0B 41 JNZ L24112 C3 00 41 JMP START

Page 17: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [14 ]

4.5 EXAMPLE - 5

AIM

To generate sine - wave at DAC-1 output.

A lookup table is provided in the program for sine-wave generation. Outputdata continuously to DAC1 from this lookup table. Verify using an CRO atDAC 1 output, that the waveform is a sine-wave. The data for lookup taskis arrived by experiments.

4100 ORG 4100H4100 START:4100 21 10 41 LXI H,4110H4103 0E 46 MVI C,46H4105 LOP:4105 7E MOV A,M4106 D3 C0 OUT 0C0H4108 23 INX H4109 0D DCR C410AC2 05 41 JNZ LOP410DC3 00 41 JMP START4110 7F 8A 95 A04114 AA B5 BF C84118 D1 D9 E0 E7411CED F2 F7 FA4120 FC FE FF FE4124 FC FA F7 F24128 ED E7 E0 D9412CD1 C8 BF B54130 AA A0 95 8A4134 7F 74 69 5F4138 53 49 3F 36413C2D 25 1D 174140 10 0B 01 044144 07 0B 10 174148 1D 25 2D 364150 3F 49 53 5F 4154 69 74

Page 18: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [15 ]

EXAMPLE-6 This Program optional one for Temperature controllerunit

AIM

To write a program to control temperature for given set point using ON-OFF controller unit.

As explained in the earlier chapter you can interface VBMB-002 and ITB-005. Connect power connector of ITB-005 to connector P3 of VBMB-002.Connect the output of ITB 005 at P2 to ADC input (Pin no.3 of P2) inVBMB-002. Execute the following program. We are using simple countermethod, to convert Analog signal to Digital signal.

PROGRAM

DAC1 EQU 0C0H OUTPUT EQU 0D0H

4100 INIT:4100 3E FF MVI A,0FFH4102 D3 C8 OUT 0C8H4104 START:4104 3E 00 MVI A,00H4106 REPEAT:4106 47 MOV B,A4107 D3 C0 OUT C0H4109 DB D0 IN D0H410B E6 01 ANI 01H410D C2 15 41 JNZ FINAL4110 78 MOV A,B4111 3C INR A4112 C3 06 41 JMP REPEAT4115 FINAL:4115 78 MOV A,B4116 32 00 50 STA 5000H4119 E6 0F ANI 0FH411B 32 02 50 STA 5002H

Page 19: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [16 ]

411E 78 MOV A,B411F E6 F0 ANI 0F0H4121 0F RRC4122 0F RRC4123 0F RRC4124 0F RRC4125 32 01 50 STA 5001H4128 21 01 50 LXI H,5001H412B 3E 03 MVI A,03H412D 0E 08 MVI C,08H412F CD 05 00 CALL00054132 3A 00 50 LDA 5000H4135 FE C0 CPI C0H4137 DA 00 41 JC INIT413A 3E 7F MVI A,7FH413C D3 C8 OUT 0C8H413E C3 04 41 JMP START4141 END

[For the digital data 80 to FF equals to temperature 0 to 100 degree. SinceDigital to analog converter is Bipolar one, we can add 80 (hexa decimalvalue) forgetting digital data corresponds to temperature.]

I.e. -5 Volt 0Volt +5Volt

00(hex) 80 FF

0 deg.C 100deg.C

The digital data to be outputted is configured as

Digital data for required voltageH RV FH

80 7

5

( * )

Rv = Required voltage corresponds to temperature.

Digital data to be outputted for required temperature,

Digital data for required temp = 80H+(Rt*7FH)/100

Page 20: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [17 ]

Rt = Required temperature in Deg.C

For example, for required 50 deg.C

Digital data = 80H+50*7FH/100

Formula for obtaining the temperature corresponds to the digital datadisplayed in the trainer kit is:

Temperature = (Hex data - 7F)*100/128[displayed in the trainer kit].

The characteristic of LM 311 is such that it goes high only when the I/P isa little bit higher than reference voltage. At the time the comparator outputgoes high, the actual digital input for DAC and the digital equivalent ofmeasured voltage are not equal and they differ by one bit. So to get anerror free result the count in DAC input is decremented, by one.

4.7 EXERCISES

1. Generate sine-waves at DAC 1 and DAC 2 output with differentfrequencies, simultaneously.

2. The two DAC’s outputs can be used to control the X and Y deflectionof an CRO. With the CRO in X-Y mode, can you create alphabets inthe CRO screen ? And numerals? And messages? And if possiblesome figures?.

3. Give a voltage between -5V and +5V at pin 3 of P2. Write a programto find out the equivalent hex value by successive approximationmethod.

Page 21: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [18 ]

CHAPTER - 5TESTING POINTS

Testing points have been provided to enable you to see the nature of thesignals.

In this board (refer circuit diagram in Appendix-A), the two testing points T1and T2 represent, the chip select signals derived from 3 to 8 decoder 74LS138.

T1 - CS I Clocks the latch 74LS273 (U5)

T2 - CS 2 Clocks the latch 74LS273 (U6)

CS I Signal becomes active when I/O read or write operation is performedon the device with the address C0H.

CS 2 Signal becomes active when I/O read or write operation isperformed on the device with the address C8H.

Execute the software examples presented in the previous section andsimultaneously observe signals at the testing points T1 and T2 using aCRO.

Please refer to the Circuit Diagram (Appendix-A) and the Component Layout(Appendix-B) for more details.

Page 22: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [19 ]

APPENDIX - AIC DATA SHEETS

Page 23: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [20 ]

Page 24: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [21 ]

Page 25: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [22 ]

Page 26: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [23 ]

Page 27: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [24 ]

Page 28: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [25 ]

Page 29: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [26 ]

Page 30: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [27 ]

Page 31: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [28 ]

Page 32: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [29 ]

Page 33: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [30 ]

Page 34: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [31 ]

Page 35: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [32 ]

Page 36: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [33 ]

APPENDIX - BIC PINOUTS

B

GND

Y7

G1

G2B

G2A

16

15

14

13

12

11

10

98

7

6

5

4

3

2

1

Y6

Y5

Y4

Y3

Y2

Y1

Y0

VCC

C

A

TO 8 LINE DECODER

Quad-3-State Buffer

CLR

1D

VCC

8Q

8D

7D

7Q

6Q

6D

5D

1

2

3

4

5

6

7

8 13

14

15

16

17

18

19

20

2D

2Q

3Q

3D

4D

1Q

GND

4Q 12

1110

9

CLK

5Q

74273

VLC

V

COMPENSATION

VREF(-)

VREF(+)

V

B1 LSB

B2

B3

B4

1

2

3

4

5

6

7

8 9

10

11

12

13

14

15

16

IOUT

MSB B8

B7

B6

B5

IOUT

DAC0800 - DIGITAL TO ANALOG CONVERTER

SIGNAL INPUT/

OUTPUT

DESCRIPTION

B1-B8

VLC

VREF(-)

VREF(+)

IOUT

IOUT

V+

-V

I

I

I

O

DIGITAL INPUTS

THRESHOLD CONTROL

REFERANCE VOLTAGES

COMPLEMENTARY

CURRENT OUTPUTS

+12V POWER SUPPLY

-12V POWER SUPPLY

OPERATIONAL AMPLIFIER

OFFSET NULL

NON-INVERET I/P

NC

V

OUTPUT

OFFSET NULL

1

2

3

4 5

6

7

8

V

INVERT I/P

-

+

+

-

INPUT

V

8

7

6

54

3

2

1

INPUT OFFSET

I/P OFFSET/STROBE

V

OUTPUT

INPUT

GND

VOLTAGE COMPARATOR

LM741 LM311

7400

1B

GND

2Y

2B

2A

14

13

12

11

10

9

87

6

5

4

3

2

1

6D

6Q

7Q

7D

8D

8Q

VCC

1Y

1A

NAND GATE NAND GATE

1G

1Y

VCC

4G

4A

4Y

3G

3A

3Y

1

2

3

4

5

6

7 8

9

10

11

12

13

14

2G

2A

2Y

GND

1A

74125

Page 37: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [34 ]

APPENDIX - C

CIRCUIT DIAGRAM

Page 38: DAC interfacing

5 5

4 4

3 3

2 2

1 1

DD

CC

BB

AA

VC

C

+12V

+12V

-12V

-12V

+12V

+12V

VC

C-1

2V

+12V

+12V

+12V

+12V

-12V

D0

D1

D2

D3

D4

D5

D6

D7

PA

0P

A1

PA

2P

A3

PA

4P

A5

PA

6P

A7

CS

1-

RS

T-

PA

0P

A1

PA

2P

A3

PA

4P

A5

PA

6P

A7

IOU

T1-

IOU

T1-

DA

C1

D0

D1

D2

D3

D4

D5

D6

D7

IOU

T2-

CS

2-

RS

T-

DA

C2

IOU

T2-

PB

0P

B1

PB

2P

B3

PB

4P

B5

PB

6P

B7

PB

0P

B1

PB

2P

B3

PB

4P

B5

PB

6P

B7

Title

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

4

MO

DE

L : V

BM

B -

002

Vi Mi

crosy

stems

Pvt.

Ltd.,

Che

nnai-96

.D

RN

BY

: Mrs

.R.V

CH

K B

Y :

Mrs

.R.K

A

12

Frid

ay, A

ugus

t 26,

201

1

DA

C IN

TE

RFA

CE

BO

AR

D

Title

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

4

MO

DE

L : V

BM

B -

002

Vi Mi

crosy

stems

Pvt.

Ltd.,

Che

nnai-96

.D

RN

BY

: Mrs

.R.V

CH

K B

Y :

Mrs

.R.K

A

12

Frid

ay, A

ugus

t 26,

201

1

DA

C IN

TE

RFA

CE

BO

AR

D

Title

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

4

MO

DE

L : V

BM

B -

002

Vi Mi

crosy

stems

Pvt.

Ltd.,

Che

nnai-96

.D

RN

BY

: Mrs

.R.V

CH

K B

Y :

Mrs

.R.K

A

12

Frid

ay, A

ugus

t 26,

201

1

DA

C IN

TE

RFA

CE

BO

AR

D

R10

5.6K

R10

5.6K

R12

2.2K

R12

2.2K

C4

0.1M

FC

40.

1MF

DC

90.

1MF

DC

90.

1MF

DC

50.

1MF

DC

50.

1MF

D4

1N41

48D

41N

4148

U5

74LS

273

U5

74LS

273

D1

3

D2

4

D3

7

D4

8

D5

13

D6

14

D7

17

D8

18

CLK

11

CLR

1

Q1

2

Q2

5

Q3

6

Q4

9

Q5

12

Q6

15

Q7

16

Q8

19

VC

C*

20

GN

D10

C3

0.1M

FC

30.

1MF

- +

U7

LM74

1

- +

U7

LM74

1

326

71

45

R14

5.1K

R14

5.1K

R9

5.1K

R9

5.1K

DC

100.

1MF

DC

100.

1MF

R7

2.2K

R7

2.2K

C1

0.1M

FC

10.

1MF

D5

5.6V

D5

5.6V

D3

3.9V

D3

3.9V

DC

7A0.

1MF

DC

7A0.

1MF

DC

10A

0.1M

FD

C10

A0.

1MF

R11

100E

/.5W

R11

100E

/.5W

R13

2.2K

R13

2.2K

- +

U10

LM74

1

- +

U10

LM74

1

326

71

45

DC

70.

1MF

DC

70.

1MF

U6

DA

C08

00

U6

DA

C08

00

B8

12

B7

11

B6

10

B5

9

B4

8

B3

7

B2

6

B1

5

VR

+14

VR

-15

IOU

T4

IOU

T2

CO

MP

16V

LC1

V+

13V

-3

U8

74LS

273

U8

74LS

273

D1

3

D2

4

D3

7

D4

8

D5

13

D6

14

D7

17

D8

18

CLK

11

CLR

1

Q1

2

Q2

5

Q3

6

Q4

9

Q5

12

Q6

15

Q7

16

Q8

19

VC

C*

20

GN

D10

R6

100E

/.5W

R6

100E

/.5W

D6

3.9V

D6

3.9V

DC

80.

1MF

DC

80.

1MF

C2

0.1M

FC

20.

1MF

R15

5.6K

R15

5.6K

D1

1N41

48D

11N

4148

D2

5.6V

D2

5.6V

R8

2.2K

R8

2.2K

U9

DA

C08

00

U9

DA

C08

00

B8

12

B7

11

B6

10

B5

9

B4

8

B3

7

B2

6

B1

5

VR

+14

VR

-15

IOU

T4

IOU

T2

CO

MP

16V

LC1

V+

13V

-3

DC

60.

1MF

DC

60.

1MF

Page 39: DAC interfacing

5 5

4 4

3 3

2 2

1 1

DD

CC

BB

AA

VC

CV

CC

+12V

-12V

+12V -1

2V

VC

C

VC

C

VC

C

VC

C

VC

CC

MO

S V

CC

VC

C

-12V

+12V

+30V

VC

C

VC

C

+12V

-12V

-12V

+12V

+30V

VC

C

ALE

RS

T

DA

C1

AD

C I/

P

PC

0

OU

T

CS

1-C

S2-

CS

3-

A3

A4

A5

A6

A7

IOR

-

IOW

-

CS

3-

OU

TD

0

DA

C1

DA

C2

AD

C I/

PC

S1-

CS

2-

D0

D1

D2

D3

D4

D5

D6

D7

RS

T-IO

R-

IOW

-P

CLK

MW

-M

R-

INTA

-IN

TR

RS

T5.5

RS

T6.5

RS

T7.5

A0

A1

A2

A3

A4

A5

A6

A7

A8

A9

A10

A11

A12

A13

A14

A15

Title

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

4

MO

DE

L : V

BM

B -

002

Vi Mi

crosy

stems

Pvt.

Ltd.,

Che

nnai-96

.D

RN

BY

: Mrs

.R.V

CH

K B

Y :

Mrs

.R.K

A

22

Thur

sday

, Aug

ust 2

5, 2

011

DA

C IN

TE

RFA

CE

BO

AR

D

Title

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

4

MO

DE

L : V

BM

B -

002

Vi Mi

crosy

stems

Pvt.

Ltd.,

Che

nnai-96

.D

RN

BY

: Mrs

.R.V

CH

K B

Y :

Mrs

.R.K

A

22

Thur

sday

, Aug

ust 2

5, 2

011

DA

C IN

TE

RFA

CE

BO

AR

D

Title

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

4

MO

DE

L : V

BM

B -

002

Vi Mi

crosy

stems

Pvt.

Ltd.,

Che

nnai-96

.D

RN

BY

: Mrs

.R.V

CH

K B

Y :

Mrs

.R.K

A

22

Thur

sday

, Aug

ust 2

5, 2

011

DA

C IN

TE

RFA

CE

BO

AR

D

DC

40.

1MF

DC

40.

1MF

DC

4A0.

1MF

DC

4A0.

1MF

DC

10.

1MF

DC

10.

1MF

P1

J801

-4

P1

J801

-4

1 2 3 4

U2B

74LS

00U

2B74

LS00

4 56

DC

20.

1MF

DC

20.

1MF

U3A

74LS

125

U3A

74LS

125

23

141

7

R3

330E

R3

330E

J1 JMP

J1 JMP

1 2 3

DC

3

0.1M

F

DC

3

0.1M

F

L3S

M/0

805

L3S

M/0

805

U1

74LS

138

U1

74LS

138

A1

B2

C3

Y015

Y114

Y213

Y312

Y411

Y510

Y69

Y77

VC

C16

GND 8

G1

6

G2A

4

G2B

5

U2A

74LS

00U

2A74

LS00

1 23

14 7

T1T1

1

R2

330E

R2

330E

P2A

5 P

IN P

M

P2A

5 P

IN P

M

1 2 3 4 5

L1S

M/0

805

L1S

M/0

805

-+

U4

LM31

1

-+

U4

LM31

12 3

7

56418

P3

P3

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

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

R5

1KR5

1K

L2S

M/0

805

L2S

M/0

805

T2T2

1

R4

10K

R4

10K

R1

330E

R1

330E

P2

5PIN

UN

ICO

N

P2

5PIN

UN

ICO

N1 2 3 4 5

Page 40: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [37 ]

APPENDIX - D

COMPONENT LAYOUT

Page 41: DAC interfacing
Page 42: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [39 ]

APPENDIX - ESOFTWARE EXAMPLES IN 8031 ASSEMBLY

LANGUAGE

This appendix gives 6 experiments in 8031 assembly language to bedone with VBMB-002 Revision 2. Port address specified in the examplesare for Micro-51. For example port address for DAC 1 is given asEOCO. The same should be replaced by AOCO in MP-i with piggyback and FFCO in micro-31 eb. The ports and their addresses in therespective kits is shown in the table below.

PORT MICRO-51 MICROPOWER-I

MICRO-31 eb

DAC 1DAC 2

EOCOEOC8

AOCOAOC8

FFCOFFC8

1. To Obtain an Output of 0 Volts at DAC-1.

4100 74 3F MOV A,#3FH4102 90 00 00 MOV DPTR,#0E0C04105 F0 MOVX @DPTR,A4106 80 FE HERE: SJMP HERE

2. To Generate Square Waveform at DAC-2 Output.

4100 90 FF C8 MOV DPTR,#0FFC8H4103 74 00 START: MOV A,#00H4105 F0 MOVX @DPTR,A4106 12 41 12 LCALL DELAY4109 74 FF MOV A,#0FFH410B F0 MOVX @DPTR,A410C 12 41 12 LCALL DELAY410F 02 41 03 LJMP START4112 79 05 DELAY: MOV R1,#05H4114 7A FF LOOP: MOV R2,#0FFH

Page 43: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [40 ]

4116 DA FE HERE: DJNZ R2,HERE4118 D9 FA DJNZ R1,LOOP411A 22 RET411B 80 E6 SJMP START

3. To Create a Saw-tooth Waveform at the DAC-1 Output .

4100 90 FF C0 MOV DPTR,#0FFC0H4103 74 00 MOV A,#00H4105 F0 LOOP: MOVX @DPTR,A4106 04 INC A4107 80 FC SJMP LOOP

4. To Generate Triangular Waveform at DAC-2 Output.

4100 90 FF C8 MOV DPTR,#0FFC8H4103 74 00 START: MOV A,#00H4105 F0 LOOP1:MOVX @DPTR,A4106 04 INC A4107 70 FC JNZ LOOP14109 74 FF MOV A,#0FFH410B F0 LOOP2:MOVX @DPTR,A410C 14 DEC A410D 70 FC JNZ LOOP2410F 02 41 03 LJMP START

5. To Generate Sine Wave at DAC-1 OUTPUT

4100 79 00 START: MOV R1,#00H4102 7A 42 MOV R2,#42H4104 7B 46 MOV R3,#46H4106 89 82 LOOP: MOV DPL,R14108 8A 83 MOV DPH,R2410A E0 MOVX A,@DPTR410B 90 FF C0 LOOP2: MOV DPTR,#0FFC0H410E F0 MOVX @DPTR,A410F 09 INC R14110 DB F4 DJNZ R3,LOOP4112 02 41 00 LJMP START

Page 44: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [41 ]

4200 7F 8A 95 A04204 AA B5 BF C84208 D1 D9 E0 E7420C ED F2 F7 FA4210 FC FE FF FE4214 FC FA F7 F24218 ED E7 E0 D9421C D1 C8 BF B54220 AA A0 95 8A4224 7F 74 69 5F4228 53 49 3F 36422C 2D 25 1D 174230 10 0B 01 044234 07 0B 10 174238 1D 25 2D 36423C 3F 49 53 5F 4240 69 744244 69 74

6.to Measure Temperature Using ITB-005 and VBMB-002.

4100 74 00 START: MOV A,#00H4102 F8 REPT: MOV R0,A4103 90 E0 C0 MOV DPTR,#0E0C0H4106 F0 LOOP: MOVX @DPTR,A4107 90 00 00 MOV DPTR,#0E0D0410A E0 MOVX A,@DPTR410B 20 E0 04 LOOP2: JB ACC.0,FINAL410E E8 MOV A,R0410F 04 INC A4110 80 F0 SJMP REPT4112 18 FINAL: DEC R04113 88 82 MOV DPL,R04115 74 02 MOV A,#02H4117 79 02 MOV R1,#02H4119 12 00 14 LCALL 0020411C 80 E2 SJMP START

Page 45: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [42 ]

7. To Write a Program to Control Temperature for a Given Set PointUsing On-off Controller Unit.

As explained in the earlier chapter you can interface VBMB-002 and ITB-005. Convert power connector of ITB-005 to connector P3 of VBMB-002.Connect the output ITB-005 at P2 to ADC input (pin no.3 of P2) in VBMB-002. Execute the following program. To display the data in the microcontroller(LED) trainer Kit. This program utilized the function call facilityavailable in the Monitor program. We are using simple counter method, tocover Analog Signal to Digital Signal.

SYSTEM EQU 4100HDAC1 EQU 0020HOUTPUT EQU 0FFD0HDAC2 EQU 0FFC8HSTORE EQU 5000H

4100 INT:4100 74 FF INIT: MOV A,#0FFH4102 90 FF C8 MOV DPTR,#0FFC8H4105 F0 MOVX @DPTR,A4106 74 00 START: MOV A,#00H4108 F5 F0 REPEAT: MOV B,A410A 90 FF C0 MOV DPTR,#0FFC0H410D F0 MOVX @DPTR,A410E 90 FF D0 MOV DPTR,#0FFD0H4111 E0 MOVX A,@DPTR4112 54 01 ANL A,#01H4114 70 05 JNZ FINAL4116 E5 F0 MOV A,B4118 04 INC A4119 80 ED SJMP REPEAT411B E5 F0 FINAL: MOV A,B411D 90 50 00 MOV DPTR,#5000H4120 F0 MOVX @DPTR,A4121 54 0F ANL A,#0FH4123 90 50 01 MOV DPTR,#5000+1H4126 F0 MOVX @DPTR,A4127 E5 F0 MOV A,B4129 54 F0 ANL A,#0F0H

Page 46: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [43 ]

412B C4 SWAP A412C 90 50 02 MOV DPTR,#5000+2H412F F0 MOVX @DPTR,A4130 74 02 MOV A,#02H4132 79 00 MOV R1,#00H4134 75 F0 00 MOV B,#00H4137 90 50 00 MOV DPTR,#5000H413A 12 00 20 LCALL 0020H413D C3 CLR C413E 90 50 00 MOV DPTR,#5000H4141 E0 MOVX A,@DPTR4142 94 C0 SUBB A,#0C0H4144 40 BA JC INIT4146 74 7F MOV A,#7FH4148 90 FF C8 MOV DPTR,#0FFC8H414B F0 MOVX @DPTR,A414C 80 B8 SJMP .START

END

Page 47: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [44 ]

APPENDIX – FSOFTWARE EXAMPLES IN 8086 ASSEMBLY

LANGUAGE

1. To Obtain the Output of 0 Volts at DAC-1. 1000 B0 7F MOV AL,7FH1002 E6 C0 OUT 0C0H,AL1004 F4 HLT

2. To Generate Square Waveform at DAC-2 Output.

1000 START:1000 B0 00 MOV AL,00H1002 E6 C8 OUT 0C8H,AL1004 E8 09 00 CALL DELAY1007 B0 FF MOV AL,0FFH1009 E6 C8 OUT 0C8H,AL100BE8 02 00 CALL DELAY100EEB F0 JMP START1010 DELAY:1010 B9 FF 05 MOV CX,05FFH1013 LOP:1013 E2 FE LOOP LOP1015 C3 RET

3. To Create a Saw-tooth Waveform at the DAC-1 Output.

1000 START:1000 B0 00 MOV AL,00H1002 LOP:1002 E6 C0 OUT 0C0H,AL1004 FE C0 INC AL1006 75 FA JNZ LOP1008 EB F6 JMP START

Page 48: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [45 ]

4. To Generate Triangular Waveform at DAC-2 Output.

1000 START:1000 B3 00 MOV BL,00H1002 LOP:1002 88 D8 MOV AL,BL1004 E6 C8 OUT 0C8H,AL1006 FE C3 INC BL1008 75 F8 JNZ LOP100AB3 FF MOV BL,0FFH100C LOPP:100C8A C3 MOV AL,BL100EE6 C8 OUT 0C8H,AL1010 FE CB DEC BL1012 75 F8 JNZ LOPP1014 EB EA JMP START

5. To Generate Sine Wave at DAC-1 Output

1000 START:1000 BB 00 11 MOV BX,1100H1003 B1 46 MOV CL,46H1005 LOOP:1005 8A 07 MOV AL,[BX]1007 E6 C0 OUT 0C0H,AL1009 43 INC BX100AE2 F9 LOOP LOP100CEB F2 JMP START1100 7F 8A 95 A01104 AA B5 BF C81108 D1 D9 E0 E7110CED F2 F7 FA1110 FC FE FF FE1114 FC FA F7 F21118 ED E7 E0 D9111CD1 C8 BF B51120 AA A0 95 8A1124 7F 74 69 5F1128 53 49 3F 36

Page 49: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [46 ]

112C 2D 25 1D 171130 10 0B 01 041134 07 0B 10 171138 1D 25 2D 361140 3F 49 53 5F 1144 69 74

6. To Measure Temperature Using ITB-005 and VBMB-002 andMeasure the Proportional Hex Value at Location

1000 START:1000 B0 00 MOV AL,00H1002 LOP:1002 88 C3 MOV BL,AL1004 E6 C0 OUT 0C0H,AL1006 E4 D0 IN AL,0D0H1008 24 01 AND AL,01H100A 75 06 JNZ LOP1100C 88 D8 MOV AL,BL100E FE C0 INC AL1010 EB F0 JMP LOP1012 LOP1:1012 88 D8 MOV AL,BL1014 BB 00 11 MOV BX,1100H1017 88 07 MOV [BX],AL1019 F4 HLT

Page 50: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [47 ]

APPENDIX – GSOFTWARE EXAMPLES IN 86/88EB LCD ASSEMBLY

LANGUAGE

1. To Obtain the output of 0 volts at DAC-1. 1000 C6 C0 7F MOV AL,7FH1003 E6 C0 OUT 0C0H,AL1005 F4 HLT

2. To Generate Square Waveform at Dac-2 Output.

1000 START:1000 C6 C0 00 MOV AL,00H1003 E6 C8 OUT 0C8H,AL1005 E8 0B 00 CALL DELAY1008 C6 C0 FF MOV AL,0FFH100B E6 C8 OUT 0C8H,AL100D E8 03 00 CALL DELAY1010 E9 ED FF JMP START1013 DELAY:1013 C7 C1 FF 05 MOV CX,05FFH1017 LOP:1017 E2 FE LOOP LOP1019 C3 RET

3.To create a saw-tooth waveform at the DAC-1 output.

1000 START:1000 C8 C0 00 MOV AL,00H1003 LOP:1003 E6 00 OUT 0C0H,AL1005 FE C0 IN CAL1007 75 FA JNZ LOP1009 E9 F4 FF JMP START

Page 51: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [48 ]

4.To generate triangular waveform at DAC-2 output.

1000 START:1000 C6 C3 00 MOV BL,00H1003 LOP:1003 88 D8 MOV AL,BL1005 E6 C8 OUT 0C8H,AL1007 FE C3 INC BL1009 75 F8 JNZ LOP100B C6 C3 FF MOV BL,0FFH100E LOPP:100E 88 D8 MOV AL,BL1010 E6 C8 OUT 0C8H,AL1012 FE CB DEC BL1014 75 F8 JNZ LOPP1016 E9 E7 FF JMP START

5. To generate sine wave at DAC-1 output

1000 START:1000 C7 C3 00 11 MOV BX,1100H1004 C6 C1 46 MOV CL,46H1007 LOP:1007 8A 07 MOV AL,[BX]1009 E6 C0 OUT 0C0H,AL100B 43 INC BX100C E2 F9 LOOP LOP100E E9 EF FF JMP START

1100 7F 8A 95 A01104 AA B5 BF C81108 D1 D9 E0 E7110C ED F2 F7 FA1110 FC FE FF FE1114 FC FA F7 F2118 ED E7 E0 D9111C D1 C8 BF B51120 AA A0 95 8A1124 7F 74 69 5F

Page 52: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [49 ]

1128 53 49 3F 36112C 2D 25 1D 171130 10 0B 01 041134 07 0B 10 171138 1D 25 2D 361140 3F 49 53 5F 1144 69 74

6. To measure temperature using ITB-005 and VBMB-002 andmeasure the proportional hex value at Location

1000 START:1000 C6 C0 00 MOV AL,00H1003 LOP:1003 88 C3 MOV BL,AL1005 E6 C0 OUT 0C0H,AL1007 E4 D0 IN AL,0D0H1009 80 E0 01 AND AL,01H100C 75 07 JNZ LOP1100E 88 D8 MOV AL,BL1010 FE C0 INC AL1012 E9 EE FF JMP LOP1015 LOP1:1015 88 D8 MOV AL,BL1017 C7 C3 00 11 MOV BX,1100H101B 88 07 MOV [BX],AL101D F4 HLT

Page 53: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [50 ]

APPENDIX - HSOFTWARE EXAMPLES IN 8097 ASSEMBLY

LANGUAGEThis appendix gives the software examples in 8097 assemblylanguage. The I/O addresses in 8097 based kits is given below.

EXAMPLE-1

To Obtain a output 0 Volts at DAC-1.

9000 A1 C0 FF 50 LD 50,#0FFC0H9004 B1 7F 52 LDB 52,#7FH9007 C6 50 52 STB 52,[50]900A 27 FE HERE: SJMP HERE

EXAMPLE-2

To generate square waveform at DAC-2 outputSTART:

9000 A1 C8 FF 50 LD 50,#0FFC8H9004 B1 00 52 LDB 52,#00H9007 C6 50 52 STB 52,[50]900A EF 0C 00 LCALL LOP900D A1 FF 00 54 LD 54,#00FFH9011 C6 50 54 ST 54,[50]9014 EF 02 00 LCALL LOP9017 27 E7 SJMP START

LOP:9019 B1 05 53 LDB 53,#05H

LOP1:901C A1 FF 00 56 LD 56,#00FFH

LOP2:9020 05 56 DEC 569022 D7 FC JNE LOP29024 15 53 DECB 539026 D7 F4 JNE LOP19028 F0 RET

Page 54: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [51 ]

EXAMPLE - 3

To generate SAW-TOOTH waveform at DAC-1 output

START:9000 A1 C0 FF 50 LD 50,#0FF50H

LOP1:9004 B1 00 52 LDB 52,#00H

LOP:9007 C6 50 52 STB 52,[50]900A 17 52 INCB 52900C D7 F9 JNE LOP9000 DF F4 JE LOP1

EXAMPLE-4

To generate Triangular waveform at DAC-2 output.START:

9000 A1 C8 FF 50 LD 50,#0FFC8H LOP:

9004 B1 00 52 LDB 52,#00H LOP1:

9007 B0 52 53 LDB 53,52900A C6 50 53 STB 53,[50]900D 17 52 DECB 52900F D7 F6 JNE LOP19011 A1 FF 00 52 LD 52,#0FFH

LOP2:9015 A0 52 54 LD 54,529018 C6 50 54 STB 54,[50]901B 05 52 DEC 52901D D7 F6 JNE LOP2901F 27 E3 SJMP LOP

Page 55: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [52 ]

EXAMPLE-5

To generate sine waveform at DAC-1 output

START:9000 A1 00 91 50 LD 50,#9100H9004 A1 C0 52 LD 52,#0FFC0H9008 B1 46 54 LDB 54,#46H

LOP:900B B2 51 55 LDB 55,[50]+900E C6 52 55 STB 55,[52]9011 15 54 DECB 549013 D7 F6 JNE LOP9015 27 E9 SJMP START

9100 7F 8A 95 A0 9104 AA B5 BF C8 9108 D1 D9 E0 E7 910C ED F2 F7 FA 9210 FC FE FF FE 9214 FC FA F7 F2 9218 ED E7 E0 D9 921C D1 C8 BF B5 9320 AA A0 95 8A 9324 7F 74 69 5F 9328 53 49 3F 36 932C 2D 25 1D 17 9430 10 0B 01 04 9434 07 0B 10 17 9438 1D 25 2D 36 9540 3F 49 53 5F 9544 69 74

Page 56: DAC interfacing

8-BIT DIGITAL TO ANALOG CONVERTER INTERFACE VBMB- 002

Vi Microsystems Pvt. Ltd., [53 ]

APPENDIX - I

SUGGESTED REFERENCES

* Microprocessor Architecture, Programming and Applications with 8085/8080A.

By Ramesh. S.Ganokar

* Microprocessor and Interfacing.

By Douglas. V.Hall.

* Digital Principles are Applications.

By Albert Paul Maluino & Donald. P.Leach

* The 8051 Programming, Interfacing, Applications

By Howard Boyer & Ron Katz.

* Programming the Z80.

By Rodney Zags.

* Programming the 6809.

By Rodney Zags.

William Labia.