computer interfacing tutorial-printer, serial, game, usb port
 

 

3.4.1. Simple Experiment to Generate a Voltage from DAC-Parallel Port

In this lesson we are like to design, how to generate a voltage from DAC0808. There is something you must to do is to calculate the konstanta K, as you have learned in previous lesson, in this experiment we would like to generate a voltage from an input on Edit1 component.


Build the circuit as shown in figure bellow. Port Data D0 trough D7 is connected to A8 - A1, for example, we assumes that the Vref = 5 volt, R14 = 5 k, and Rf = 5k.

   K = Vref/ R14;
     = 5/5k
= 1 mA
If, we put logic high into A1 through A8 then we have:
Io = 1 mA x 0.99
= 1 mA
So,Vo = Io x Rf
= 1 mA x 5k
= 5 volt
Voltage Resolution = 5/255 = 0.02 volt

If you like to send a 2 volt out from your DAC, than you
must write down this decimal
= 2/0.02
= 100 decimal

Delphi Programming ( Download file ex341.zip )

a. Puts 1 Edit Components, 1 Button and label on Form, as shown in picture bellow.

      

b.Click on button1 component to insert with the program as shown bellow

procedure TDAC.Button1Click(Sender: TObject);
var data,DAC:byte;
begin
data:=strtoint(edit1.text);
DAC:=(Data*255) DIV 5;
asm
mov dx,$378
mov al,DAC
out dx,al
end;
end;

c. To run the program, you can hits F9 or RUN menu, and then you will show a picture as shown bellow, and try to simulate the program by a number betwen 1 trough 5 on edit1 and hit START button.


            

PREVIOUS NEXT

 

Free Software
Delphi

Lesson 1
Delphi Programming
1.1. IDE Delphi
1.2. Component


Lesson 2
Printer Port
/ LPT
1.1.Basic
1.2.Address
1.3.Port Register
1.4.8 Bit Data Input
1.5.Test Circuitry
1.6.Assignment

Lesson 3
Printer Port / LPT
Experiments

3.1.LED
3.2.Swicht
3.3.Motor Stepper
3.4.DAC
3.5.ADC
3.6.Graph Display

Lesson 4
Serial Port

4.1.Basic
4.2.Hardware
4.3.Port Register

Lesson 5
Serial Port Experiments

5.1.LED
5.2.Stepper Motor
5.3.Swicht
5.4.ADC

Lesson 6
Game Port
Joy Stick
6.1. Basic
6.2. Experiments