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

 

3.5.1 Simple Data Acquisition - Parallel Port

In this experiment we will show you how easy to get a data from ADC by using command mode WR only. Build up a circuit as shown in picture bellow. As you seen in picture, this ADC will receive voltages from 0 to 5 volt, so the Vref must be 2.5 volt.

computer interfacing parallel port Application ADC

Delphi Programming ( Download File exp351.zip )
a. Puts 1 Timer Components, 2 Edit Component and label on Form, as shown in picture bellow.

computer interfacing parallel port Application ADC

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

procedure TADC.Timer1Timer(Sender: TObject);
var dataA,dataB,data:byte;voltage:real;
begin
asm
mov dx,$378 {Port Data}
mov al,00000010b {Start Conversion Pulse WR=1}
out dx,al
;
mov dx,$378 {Port Data}
mov al,00000000b {Start Conversion Pulse WR=0}
out dx,al
;
mov dx,$378 {Port Data}
mov al,00000010b {Start Conversion Pulse WR=1}
out dx,al
;
mov dx,$378 {Port Data}
mov al,00000010b {Drive A/B=0,to select D0-D3,from MUX74157}
out dx,al
;
mov dx,$379 {Port Status}
in al,dx {get data D0-D3 from Mux}
and al,11110000b {masking bit D0-D3 for Port Status}
xor al,10000000b {Bit 7 Inverting}
mov dataA,al {saving data Reg AL to variable Data}
;
;
mov dx,$378 {Port Data}
mov al,00000011b {Drive A/B=1,to select D0-D3,from MUX74157}
out dx,al
;
mov dx,$379 {Port Status}
in al,dx {get data D0-D3 from Mux}
and al,11110000b {masking bit D0-D3 for Port Status}
xor al,10000000b {Bit 7 Inverting}
mov dataB,al {saving data Reg AL to variable Data}
;
end;
data:=( DataA DIV 16 ) + DataB;
voltage:=data*5/255;
Edit1.text:=inttostr(data);
Edit2.text:=floattostr(voltage);
end;
c. To run the program, you can hits F9 or RUN menu, and then you will see a picture as shown bellow, and try to simulate the program by turning arround the variable rasistor.

 

computer interfacing parallel port Application ADC

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