update kalau tdk bisa cb ini : ROCHIM_MY ELECTRIC: Februari 2011

Sabtu, 26 Februari 2011

Interfacing Parallel Port with Visual Basic

Microsoft’s Visual Basic has been the most popular choice for Basic programmers developing Windows programs. Unlike other Basics, however, Visual Basic for Windows doesn’t include Inp and Out for port access. However, you can add Inp and Out to the language in a dynamic linked library (DLL). A DLL contains code that any Windows program can access, including the programs you write in Visual Basic. This tutorial includes IO.dll and you can download this file in http://www.geekhideout.com/iodll.shtml .

This is the DLL itself, containing the routines that your programs will access. You can call the prototype of that routines like this

Public Declare Sub PortOut Lib "io.dll" (ByVal Port As Integer, ByVal Data As Byte)
Public Declare Function PortIn Lib "io.dll" (ByVal Port As Integer) As Byte 
 
Or like this:

Private Declare Sub PortOut Lib "io.dll" (ByVal Port As Integer, ByVal Data As Byte)
Private Declare Function PortIn Lib "io.dll" (ByVal Port As Integer) As Byte


For Example:

Private Declare Sub PortOut Lib "io.dll" (ByVal Port As Integer, ByVal Data As Byte)
Private Declare Function PortIn Lib "io.dll" (ByVal Port As Integer) As Byte 

Private Sub Command1_Click()
PortOut 888, 0 'All LED OFF
End Sub
Private Sub Command2_Click()
PortOut 888, 255 'All LED ON
End Sub

It's Very Easy! You Can Do it in your home! Keep Smile and Stay On My Blog!

Keyword: Interfacing Port Parallel, Interfacing port paralel , interfacing using visual basic, interfacing menggunakan visual basic,