Skip to main content

Accessing PC Parallel Port (LPT Port) With Borland Delphi 7.0 Using Small Port Component

This article will lead you how to make a program to access input output data in parallel port, simple example, this program is used to turn on and turn of LED which is set in Parallel Port, Data Register in computer (Pin D2 until pin D9) in Parallel Port/ LPT.
The steps are as follows:
Enter the following component in Form 1:

No Component Property Value
1 Shape1 Name ShpLED1
Shape stCircle
Height 41
Width 41
Brush Color clWhite
Brush Style bsSolid
2 Shape2 Name ShpLED2
Shape stCircle
Height 41
Width 41
Brush Color clWhite
Brush Style bsSolid
3 Shape3 Name ShpLED3
Shape stCircle
Height 41
Width 41
Brush Color clWhite
Brush Style bsSolid
4 Shape4 Name ShpLED4
Shape stCircle
Height 41
Width 41
Brush Color clWhite
Brush Style bsSolid
5 Shape5 Name ShpLED5
Shape stCircle
Height 41
Width 41
Brush Color clWhite
Brush Style bsSolid
6 Shape6 Name ShpLED6
Shape stCircle
Height 41
Width 41
Brush Color clWhite
Brush Style bsSolid
7 Shape7 Name ShpLED7
Shape stCircle
Height 41
Width 41
Brush Color clWhite
Brush Style bsSolid
8 Shape8 Name ShpLED8
Shape stCircle
Height 41
Width 41
Brush Color clWhite
Brush Style bsSolid
9 EditText1 Name EdLED1
Text -
10 EditText2 Name EdLED2
Text -
11 EditText3 Name EdLED3
Text -
12 EditText4 Name EdLED4
Text -
13 EditText5 Name EdLED5
Text -
14 EditText6 Name EdLED6
Text -
15 EditText7 Name EdLED7
Text -
16 EditText8 Name EdLED8
Text -
17 Button1 Name BtnNyalaLED1
Caption NyalakanLED1
18 Button2 Name BtnNyalaLED2
Caption NyalakanLED2
19 Button3 Name BtnNyalaLED3
Caption NyalakanLED3
20 Button4 Name BtnNyalaLED4
Caption NyalakanLED4
21 Button5 Name BtnNyalaLED5
Caption NyalakanLED5
22 Button6 Name BtnNyalaLED6
Caption NyalakanLED6
23 Button7 Name BtnNyalaLED7
Caption NyalakanLED7
24 Button8 Name BtnNyalaLED8
Caption NyalakanLED8
25 Button9 Name BtnMatiLED1
Caption MatikanLED1
26 Button10 Name BtnMatiLED2
Caption MatikanLED2
27 Button11 Name BtnMatiLED3
Caption MatikanLED3
28 Button12 Name BtnMatiLED4
Caption MatikanLED4
29 Button13 Name BtnMatiLED5
Caption MatikanLED5
30 Button14 Name BtnMatiLED6
Caption MatikanLED6
31 Button15 Name BtnMatiLED7
Caption MatikanLED7
32 Button16 Name BtnMatiLED8
Caption MatikanLED8
33 Button17 Name BtnOpenPort
Caption Open Port
34 Button18 Name BtnClosePort
Caption CloseProgram
35 SmallPort1 Name SmPort1





In the monitor will appear image like the following;  
 
Picture1. Accessing PC Parallel Port (LPT Port) With Borland Delphi 7.0 Using Small Port Component : Visualization of the Program which will be made.
Before making listing program (source code) first we decide 2 variables which will be used; those are “data” and “NewData” which mean:
NO. NAMA KOMPONEN SOURCE CODE
1 BtnMatiLED1 data := SmPort1.ReadByte($378);
baru := data AND 254;
SmPort1.WriteByte($378,baru);
ShpLED1.Brush.Color := clBlack;
EdLED1.Text:='OFF';
2 BtnMatiLED2 data := SmPort1.ReadByte($378);
baru := data AND 253;
SmPort1.WriteByte($378,baru);
ShpLED2.Brush.Color := clBlack;
EdLED2.Text:='OFF';
3 BtnMatiLED3 data := SmPort1.ReadByte($378);
baru := data AND 251;
smport1.WriteByte($378,baru);
ShpLED3.Brush.Color := clBlack;
EdLED3.Text:='OFF';
4 BtnMatiLED4 data := SmPort1.ReadByte($378);
baru := data AND 247 ;
SmPort1.WriteByte($378,baru);
ShpLED4.Brush.Color := clBlack;
EdLED4.Text:='OFF';
5 BtnMatiLED5 data := SmPort1.ReadByte($378);
baru := data AND 239;
SmPort1.WriteByte($378,baru);
ShpLED5.Brush.Color := clBlack;
EdLED5.Text:='OFF';
6 BtnMatiLED6 data := SmPort1.ReadByte($378);
baru := data AND 223 ;
SmPort1.WriteByte($378,baru);
ShpLED6.Brush.Color := clBlack;
EdLED6.Text:='OFF';
7 BtnMatiLED7 data := SmPort1.ReadByte($378);
baru := data AND 191;
SmPort1.WriteByte($378,baru);
ShpLED7.Brush.Color := clBlack;
EdLED7.Text:='OFF';
8 BtnMatiLED8 data :=SmPort1.ReadByte($378);
baru := data AND 127;
SmPort1.WriteByte($378,baru);
ShpLED8.Brush.Color := clBlack;
EdLED8.Text:='OFF';
9 BtnNyalaLED1 data := SmPort1.ReadByte($378);
baru := data or 1;
SmPort1.WriteByte($378,baru);
ShpLED1.Brush.Color := clRED;
edLED1.Text:='ON';
10 BtnNyalaLED2 data := SmPort1.ReadByte($378);
baru := data or 2;
SmPort1.WriteByte($378,baru);
ShpLED2.Brush.Color := clRED;
edLED2.Text:='ON';
11 BtnNyalaLED3 data := SmPort1.ReadByte($378);
baru := data or 4;
SmPort1.WriteByte($378,baru);
ShpLED3.Brush.Color := clRED;
edLED3.Text:='ON';
12 BtnNyalaLED4 data := SmPort1.ReadByte($378);
baru := data or 8;
SmPort1.WriteByte($378,baru);
ShpLED4.Brush.Color := clRED;
edLED4.Text:='ON';
13 BtnNyalaLED5 data := SmPort1.ReadByte($378);
baru := data or 16;
SmPort1.WriteByte($378,baru);
ShpLED5.Brush.Color := clRED;
edLED5.Text:='ON'
14 BtnNyalaLED6 data := SmPort1.ReadByte($378);
baru := data or 32;
SmPort1.WriteByte($378,baru);
ShpLED6.Brush.Color := clRED;
edLED6.Text:='ON';
15 BtnNyalaLED7 data := SmPort1.ReadByte($378);
baru := data or 64;
SmPort1.WriteByte($378,baru);
ShpLED7.Brush.Color := clRED;
edLED7.Text:='ON';
16 BtnNyalaLED8 data := SmPort1.ReadByte($378);
baru := data or 128;
SmPort1.WriteByte($378,baru);
ShpLED8.Brush.Color := clRED;
edLED8.Text:='ON';
17 BtnOpenPort SmPort1.Opened:=true;
18 BtnCloseProgram Close;
            “Data” is value that will be read from parallel port in the form of 8 bit data (1 byte)
“New data” is value that will be written to the parallel port after conducted

“Modification” with logical “and” or “or” to conduct bit setting or bit clearing data which is written in the form of 8 bit data (1 byte)
Variable writing decision is conducted under the writing:
var
Form 1:Tform1;
The result is as follows: 
Picture 2. Accessing PC Parallel Port (LPT Port) With Borland Delphi 7.0 Using Small Port Component : variable declaration
The next step is how to make source code program comprehensively so that the program can be used:
Type source code below, appropriate with each component which mean:




result of program execution is like this:  


Picture 3. Accessing PC Parallel Port (LPT Port) With Borland Delphi 7.0 Using Small Port Component : The Result of Program Execution.

 I hope this writing can give benefit to the visitors, readers, developer and me. Thanks for visiting and availability for sharing this article by pressing Share To Facebook, Twitter button or just press like button.


Popular posts from this blog

Login Form Delphi by Connecting to Ms Access Database.

this the step by step  to making application :

Login Form Delphi by Connecting Ms Access Database.

In making/ building application in Delphi, login Form is an important to protect application so that cannot be open by irresponsible person. This login Form is connected with database so that able to keep a lot of username data and password. Before make the application, please create a database as the picture below:
Picture :Login  form Delphi database Microsoft Access
Save the database in the folder which use to save the application


Next step is create the application

Enter the component and the source code as follows.


No Component NameProperties Value1Label1CaptionUsername2Label2CaptionPassword3Edit1Text -4Edit2Text -5Button1CaptionLogin6Adoconnection1--7AdoQuery1ConnectionADOConnection1

Arrange the component as the picture below:


Figure. Login Form Delphi design form



 Create new form



Form properties can be check in the table below
No Component NameProperties Value1Form1CaptionSuccess…

Step by step Accessing SMS With Delphi: Sending SMS Using Borland Delphi 7 Exploit Comport Component (Siemens))

In this example, will present the way how making SMS delivery program with Delphi, basically, data in data communication series between Delphi and mobile phone happen in Format Protocol Data Unit (PDU). The destination number of sending Message and message that will be sent through Delphi program that is made have to be changed into PDU Form first, next is the data will be sent through serial port to mobile phone. To make the send SMS Application , please enter the following component to Form 1.

No Component NameProperties ValueButton1CaptionConnectButton2CaptionDisConnectButton3CaptionConvert to PDUButton4CaptionSend to HPButton5CaptionClearButton6CaptionStart Send SMSButton7CaptionSet PortEdit1Text-Edit2Text<Type The SMS here>Edit3Text-Label1Caption1) Destination Number :Label2Caption2Label3CaptionPDU lengthLabel4CaptionLabel lengthComLed1--Memo1--Memo2--Comport1--Arrange the Component  in such away so that the visualization program is as follows:


Then type the follow…

The Example Using Chart In Borland Delphi 7

The Example Using Chart In Borland Delphi 7




In this writing will discuss about how to use the chart in Delphi 7. In the example that is made by using Delphi 7, chart will appear 2 data in the form of incremental data number, the first data named data 1 and the second data named data 2. Data 1 is incremental data 1 that is begun from 0 until 10; while data 2 is same. Yet, in the beginning condition of data 1 start from 0 while data 2 start from 1.


To make application as the explanation above, please enter the components in the table below into design form.


NoComponentPropertiesValueNote1Form1CaptionThe Chart of Data on Delphi 72GroupBox1CaptionThe Chart of Data on Delphi 73Label1CaptionData 14Label2CaptionData 25Edit1Text06Edit2Text07Button1CaptionShow to Chart8Button2CaptionClose9Timer1EnabledFalse10Chart--Check the NoteNote:

Double click on chart component, set the property of chart as below:


Click on  Add.. Button

Then the following chart gallery will be shown:



Choose the…