a Microsoft Visual Basic 6.0 program for input-output hardware interfacing in DB25
► reference:
lvr.com
logix4u.net
► DB25 pin configuration (computer side)
...........\ o o o o o o o o o o o o o /
............\ o o o o o o o o o o o o /
s4 s5 s'7 s6 d7 d6 d5 d4 d3 d2 d1 d0 c'0
GND GND GND GND GND GND GND GND c'3 c2 s3 c'1
► pins
data (d)
- address: 378
- input and output
control (c) pins
- address: 37A
- output only
status (s)
- address: 379
- input only
ground (GND) = n/a
- ground
► usage:
- data
output:
x = woutput Val(&H378), n
input:
x = woutput Val(&H37A), 32
y = winput(&H378)
- status
x = winput(&H379)
- control
x = out (37A,n)
► note:
if a pin has an apostrophe, it means that it will transmit a reverse output or receive a reverse input
► steps:
1. create the hardware
2. download the inpout32.dll file
3. create a inpout32.bas file
Attribute VB_Name = "inpout"
Public Declare Function winput Lib "inpout32.dll" _
Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Public Declare Sub woutput Lib "inpout32.dll" _
Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
4. place the inpout32.dll and the inpout32.bas file inside the project folder
5. create the code
► sample code:
Option Explicit
Dim readdata As Integer
Dim readstatus As Integer
Dim ndata As Integer
Dim ncontrol As Integer
Private Sub cmdreaddata_Click()
woutput Val(&H37A), 32
readdata = winput(&H378)
lblreaddata.Caption = readdata
End Sub
Private Sub cmdwritedata_Click()
ndata = Val(txtwritedata.Text)
woutput Val(&H378), ndata
End Sub
Private Sub cmdreadstatus_Click()
readstatus = winput(&H379)
lblreadstatus.Caption = readstatus
End Sub
Private Sub cmdwitecontrol_Click()
ncontrol = Val(txtwritedata.Text)
woutput Val(&H37A), ncontrol
End Sub
  .  cdo bloggers   .  my digital corner   .  sacha chua   .  the oatmeal   .  toxel.com   . 
  .  Hotels & Resorts Worldwide   . 



