Share your VB Project

February 6, 2009

Akses Port Parellel pada VB 6.0

Filed under: Tutorial — kohimaru @ 4:38 pm

1. Ketik pada modul
‘Buat module dengan nama mdlPortIO

‘ — Begin —
Option Explicit

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 of module —

2. Ketik pada code form

‘misal kita ingin mengakses pin 1 pada port paralel (DB25)
private sub commandPin1_click()

out 888, 1 ‘888 adalah port address & 1 adalah pin
end sub

‘Nilai port
pin 1 = 1
pin 2 = 2
pin 3 = 4
pin 4 = 8
pin 5 = 16
pin 6 = 32
pin 7 = 64
pin 8 = 128

jika ingin menggabungkan antara port, gunakan perintah sbb:
out 888, 1 + 8

artinya kita akan menjalankan port 1 & 4 secara bersamaan

NOTE:
Fungsi IO_port membutuhkan inpOut32.dll (download disini)
letakkan file tersebut pada folder tempat dari program

Referensi : http://kohimaru.wordpress.com/category/vb-60/

Selamat mencoba

Leave a Comment »

No comments yet.

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.