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

 

3.2.2. Input and Output Data - Parallel Port

Program exp322.pas detects input from swichts and gives an action by outputting data that have been detected to Port Data that connected to 8 LED. Form design is shown in picture bellow.

Delphi Programming ( Download File exp322.zip )

a. Puts 1 Timers Components, 1 Edit Components and label on Form, as shown in picture bellow. Setting up Timer1 component for Enabled = true, and Interval = 1000 ( approximataly = 1000 ms delay time ).

           

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

procedure TInput.Timer1Timer(Sender: TObject);
var data:byte;
begin
asm
mov dx,$379
in al,dx
mov data,al
and data,11111000b
xor data,10000000b
end;
edit1.text:=inttostr(data);
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 changing input swicht.

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