Connect with us

PC-GPIB card

Discussion in 'Electronic Equipment' started by Tobin Fricke, Mar 6, 2004.

Scroll to continue with content
  1. Tobin Fricke

    Tobin Fricke Guest

    I have an old (from 1984) GPIB-PC interface card from National
    Instruments, an 8-bit ISA interface card to the IEEE-488 / GPIB / HPIB
    instrumentation bus. I'm wondering if anyone out there has the software
    drivers (for DOS) to use the card and/or information on talking to it from
    custom software.

  2. mike

    mike Guest

    I had a similar situation. My card uses a 9914 chip attached directly
    to the PC bus. I bit-bang it to implement a subset of the gpib standard
    to run a spectrum analyzer and power supply. The command set is not all
    that complicated. TI published a very nice application note back in the

    This was ported from quick basic and all the functions have not been

    MultiUse = -1 'True
    Persistable = 0 'NotPersistable
    DataBindingBehavior = 0 'vbNone
    DataSourceBehavior = 0 'vbNone
    MTSTransactionMode = 0 'NotAnMTSObject
    Attribute VB_Name = "GPIB"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = True
    Attribute VB_PredeclaredId = False
    Attribute VB_Exposed = False
    Option Explicit
    'Function Declares
    'Inp and Out declarations for direct port I/O
    'in 32-bit Visual Basic 4 programs.
    Private Declare Function Inp Lib "inpout32.dll" _
    Alias "Inp32" (ByVal PortAddress As Integer) As Integer
    Private Declare Sub Out Lib "inpout32.dll" _
    Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

    'variable declarations
    Dim abase, instadr, stadr, ladr, Unlall, Untall, intst0, intst1 As Integer
    Dim addstat, bustat, cpass, datain, imask0, imask1, auxcmdr, st0byt,
    st1byt As Integer
    Dim address, serpoll, parpoll, dataout, sswrst, cswrst, ssic, csic,
    ssre, csre, feoi, sget, cget As Integer
    Dim tcs, gts, unl, ton, toff, lon, loff, tca, Sdc, Dcl, aGet, gtl As Integer

    Property Get datastring() As String
    Dim byt As Integer
    Dim temp As String
    Dim bcount As Integer
    'get string response to query
    temp = ""
    Out auxcmdr, tca
    dbout (Untall)
    dbout (Unlall)
    Out auxcmdr, ssre 'mote enable
    dbout (stadr)
    Out auxcmdr, lon
    Out auxcmdr, gts
    bcount = 9000
    bcount = bcount - 1
    st0byt = Inp(intst0)
    If ((st0byt And 32) <> 32 And bcount > 0) Then GoTo wait1
    If bcount < 1 Then Debug.Print "wait timeout in byte input"
    byt = Inp(datain)
    temp = temp & Chr$(byt)
    If (st0byt And 8) <> 8 Then GoTo nextrbyt
    Debug.Print "Input String "; temp
    Out auxcmdr, loff
    Out auxcmdr, tca
    dbout (gtl)
    dbout (Untall)
    dbout (Unlall)
    Out auxcmdr, gts
    datastring = temp
    End Property

    Sub chekstat()
    Exit Sub
    Dim st0, st1, adstat As Integer
    st1 = Inp(intst1)
    st0 = Inp(intst0)
    adstat = Inp(addstat)
    End Sub
    Property Get databyte() As Integer
    Debug.Print "shouldn't get to getdatabyte"
    End Property

    Property Let datastring(strn As String)
    'send a string to the device
    Debug.Print "sending string "; strn
    Dim dlycnt As Integer
    Dim l, i As Integer
    Dim i01, i02, i11, i12 As Integer
    Dim bcount As Integer
    Dim adstat As Integer
    'strn = strn & Chr$(10)
    Out auxcmdr, tca
    dbout (Untall)
    dbout (Unlall)
    dbout (ladr)

    Out auxcmdr, gts 'drop atn
    Out auxcmdr, ton
    l = Len(strn)
    adstat = Inp(addstat)
    Sleep (1)
    For i = 1 To l
    If i = l Then Out auxcmdr, feoi
    Out dataout, Asc(Mid$(strn, i, 1))
    i01 = Inp(intst0)
    If ((i01 And &H10) = 0) Then GoTo sen2:
    Out auxcmdr, loff
    Out auxcmdr, tca
    dbout (gtl)
    dbout (Untall)
    dbout (Unlall)
    'Out auxcmdr, csre
    'Out auxcmdr, ssic 'take control raise atn
    'Sleep (1)
    'Out auxcmdr, csic
    Out auxcmdr, gts 'drop atn
    Out auxcmdr, toff
    End Property

    Private Sub dbout(byt As Integer)
    'handshake a byte to the device
    Dim i01 As Integer
    Out dataout, byt
    i01 = Inp(intst0)
    'Sleep (100)
    If ((i01 And &H10) = 0) Then GoTo sen1:
    End Sub

    Public Sub ppoll()
    Exit Sub
    Dim instring As String
    Dim ppstat As Integer
    'parallel poll and error request
    Out auxcmdr, &H8E
    ppstat = Inp(cpass)
    Debug.Print "parallel poll status= "; ppstat; ""
    Out auxcmdr, &HE
    datastring = "err?"
    instring = datastring
    Debug.Print "SRQ "; instring
    End Sub

    Public Property Let instaddress(instadr As Integer)
    'GPIB card constants
    abase = &H330
    stadr = 64 + instadr 'talk address
    ladr = 32 + instadr 'listen address
    Unlall = 31 + 32 'commands to unlisten/talk all devices
    Untall = 31 + 64
    'note address bits 0 and 2 on the 9914 are swapped on the gpib card
    'have to swizzle the addresses of all internal registers like this
    intst0 = abase
    intst1 = abase + 4
    addstat = abase + 2
    bustat = abase + 6
    cpass = abase + 3
    datain = abase + 7
    imask0 = abase
    imask1 = abase + 4
    auxcmdr = abase + 6
    address = abase + 1
    serpoll = abase + 5
    parpoll = abase + 3
    dataout = abase + 7
    'these are auxiliary commands
    sswrst = &H80
    cswrst = &H0
    ssic = &H8F
    csic = &HF
    ssre = &H90
    csre = &H10
    feoi = &H8
    sget = &H86
    cget = &H6
    Unlall = &H3F
    Untall = &H5F
    gts = &HB
    ton = &H8A
    toff = &HA
    lon = &H89
    loff = &H9
    tca = &HC
    tcs = &HD
    Sdc = &H4
    Dcl = &H14
    aGet = 8
    gtl = 1
    Sleep (10)
    'setup 9914 on gpib interface board
    Out auxcmdr, sswrst
    Out address, 0 'controller address
    Out imask0, 0 'disable interrupts
    Out imask1, 0
    Out auxcmdr, cswrst
    Out auxcmdr, csic
    Out auxcmdr, ssic 'interface clear
    Sleep (100)
    Out auxcmdr, csic 'puts controller into active state
    Out auxcmdr, ssre 'remote enable
    End Property


    Return address is VALID.
    Bunch of stuff For Sale and Wanted at the link below.
    Toshiba & Compaq LiIon Batteries, Test Equipment
    Honda CB-125S $800 in PDX
    TEK Sampling Sweep Plugin and RM564
    Tek 2465 $800, ham radio, 30pS pulser
    Tektronix Concept Books, spot welding head...
  3. Aidan Grey

    Aidan Grey Guest

    Have you searched for software at

    Aidan Grey
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day