this project i made using visual studio (vb project).So the names and options i use may be differ from the visual basic
1.first of all you need to download a dll library file called inpout32.dll.(this file allow to read write data to parallel port for widows versions after windows 98)
http://www.dll-files.com/dllindex/dll-files.shtml?inpout32
download zip file from above link and add inpout32.dll file in to c:/windows/system32 folder
2.Now you can made a new project (windows form application) in vb with any name you want.I made my project as "code".
3.Next you have to add a module for the project to use library inpout32.dll
FIGURE 1 FIGURE 2


i. Right click of the project (from solution explorer window which is in right hand corner of the visual studio)
ii. Then choose "add" from the popup menu
iii. Next choose "module" from the next popup menu
iv. Then select "module" (if it not already select) from next window which is open and Type any considerable name for the new module that you're going to create, for example, port.vb
Go to your form and add a new text box. Then add a Command button and, in the click event of the command button, paste this code:
'Declare variables to store read information and Address values
Dim intAddress As Integer, intReadVal As Integer
'Get the address and assign
intAddress = 889
'Read the corresponding value and store
intReadVal = porting.Inp(intAddress)
txtStatus.Text = intReadVal.ToString()
This will work well only if the name of the text box you just made is txtStatus.
Run your application and click on the button so that the text should be 120 or some similar value. Then that is the status of your parallel port.
If you want to check whether this application runs properly, you just have to take a small wire (screen wire or circuit wire is ok) and short a Status Pin and a Ground Pin. For example, Status pins are 10,11,12,13,15 and if you short the 10th pin and 25th (Ground) pin, then the value in the textbox will be 104. If you short some other pins, like the 11th and 25th, then the value of the text box will be 88 or a similar value.
Write a value to the parallel port
intVal2Write As Integer
'Read the corresponding value and store
intVal2Write = Convert.ToString(txtWriteVal.Text)
'porting is the name of the module
porting.Out(888, intVal2Write)
This will work properly only if the name of the text box you just made is txtWriteVal.
Run your application and click on the Button so that the parallel port will output voltages in pins according to the value you entered in the text box.
NEXT tutorial: How to make a key board for braille language using parallel port (coming soon....)
1.first of all you need to download a dll library file called inpout32.dll.(this file allow to read write data to parallel port for widows versions after windows 98)
http://www.dll-files.com/dllindex/dll-files.shtml?inpout32
download zip file from above link and add inpout32.dll file in to c:/windows/system32 folder
2.Now you can made a new project (windows form application) in vb with any name you want.I made my project as "code".
3.Next you have to add a module for the project to use library inpout32.dll
FIGURE 1 FIGURE 2
i. Right click of the project (from solution explorer window which is in right hand corner of the visual studio)
ii. Then choose "add" from the popup menu
iii. Next choose "module" from the next popup menu
iv. Then select "module" (if it not already select) from next window which is open and Type any considerable name for the new module that you're going to create, for example, port.vb
v. click "add" button
4.Add this code to module
Module port
Public Declare Function Inp Lib "inpout32.dll" _
Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Public Declare Sub Out Lib "inpout32.dll" _
Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
End Module
Now you can access the parallel port
Module port
Public Declare Function Inp Lib "inpout32.dll" _
Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Public Declare Sub Out Lib "inpout32.dll" _
Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
End Module
Now you can access the parallel port
Read an input from the parallel port
Go to your form and add a new text box. Then add a Command button and, in the click event of the command button, paste this code:
'Declare variables to store read information and Address values
Dim intAddress As Integer, intReadVal As Integer
'Get the address and assign
intAddress = 889
'Read the corresponding value and store
intReadVal = porting.Inp(intAddress)
txtStatus.Text = intReadVal.ToString()
Run your application and click on the button so that the text should be 120 or some similar value. Then that is the status of your parallel port.
If you want to check whether this application runs properly, you just have to take a small wire (screen wire or circuit wire is ok) and short a Status Pin and a Ground Pin. For example, Status pins are 10,11,12,13,15 and if you short the 10th pin and 25th (Ground) pin, then the value in the textbox will be 104. If you short some other pins, like the 11th and 25th, then the value of the text box will be 88 or a similar value.
Write a value to the parallel port
Go to your form and add a Command button. In the Click event of the Command button, paste this code:
'Read the corresponding value and store
intVal2Write = Convert.ToString(txtWriteVal.Text)
'porting is the name of the module
porting.Out(888, intVal2Write)
Run your application and click on the Button so that the parallel port will output voltages in pins according to the value you entered in the text box.
NEXT tutorial: How to make a key board for braille language using parallel port (coming soon....)
i jest read it now i can do my interface project alone thanks for the help good luck.......
ReplyDeleteIt's great pleasure to hear that. Thank you!
ReplyDeletei have a problem. it does not read the value on my textbox i dont know why can you please help me. i did shot pin 10 and 25 but there is no value on my text.
ReplyDelete