Jump to content
  • 0

Trying To Config Two USB-1024LS in System (Using Universal Library)


Creation Test Solutions

Question

The following used to be (or maybe still is) included with UL for configuring the IO for a USB-1024LS in an older VB6 application.

Can someone respond with the option(s) for adding a second USB-1024LS?


Sub USB_DIO24LS()


 BoardNum = 0    '<======this is the default board number
    Dim BoardName As String
                    'change it to what IstaCal has assigned for your USB/PMD-1024LS
    
    BoardName = "                         "
    Ulstat = cbGetBoardName(BoardNum, BoardName)
    'BoardName = "USB-1024LS"
    'Ulstat = cbGetBoardName(BoardNum, BoardName)
    
    MyBoard = BoardName
    MyBoard = Trim$(MyBoard)
    bdlen = Len(MyBoard) - 1
    MyBoard = Left(MyBoard, bdlen)
    If (MyBoard <> "PMD-1024LS") And (MyBoard <> "USB-1024LS") Then
        MyMessage = "A USB/PMD-1024LS was not assigned to Board " & BoardNum & " in InstaCal." & Chr$(13) _
                & "Please run InstaCal to verify the board number" & Chr$(13) _
                & "and/or change BoardNum = " & BoardNum & " in the Form_Load event" & Chr$(13) _
                & " to the correct board number.  Then re-run this program."
        r = MsgBox(MyMessage, vbExclamation, "USB/PMD-1024LS not detected.")
        End
    End If
      
   ' configure FIRSTPORTA for digital output
   '  Parameters:
   '    BoardNum    :the number used by CB.CFG to describe this board
   '    PortNum%    :the output port
   '    Direction%  :sets the port for input or output
   
   PortNum% = FIRSTPORTA
   Direction% = DIGITALOUT

   Ulstat = cbDConfigPort(BoardNum, PortNum%, Direction%)
   If Ulstat <> 0 Then Stop
   
   '-----------------------------------------------------------------------------
    ' configure FIRSTPORTB for digital output
    '  Parameters:
    '    BoardNum    :the number used by CB.CFG to describe this board
    '    PortNum%    :the output port
    '    Direction%  :sets the port for input or output

    PortNum% = FIRSTPORTB
    Direction% = DIGITALOUT

    Ulstat = cbDConfigPort(BoardNum, PortNum%, Direction%)
    If Ulstat <> 0 Then Stop
    
    '-----------------------------------------------------------------------------
    ' configure FIRSTPORTCL for digital output
    '  Parameters:
    '    BoardNum    :the number used by CB.CFG to describe this board
    '    PortNum%    :the output port
    '    Direction%  :sets the port for input or output

    PortNum% = FIRSTPORTCL
    Direction% = DIGITALOUT

    Ulstat = cbDConfigPort(BoardNum, PortNum%, Direction%)
    If Ulstat <> 0 Then Stop

'------------------------------------------------
    ' configure FIRSTPORTCH for digital output
    '  Parameters:
    '    BoardNum    :the number used by CB.CFG to describe this board
    '    PortNum%    :the output port
    '    Direction%  :sets the port for input or output

    PortNum% = FIRSTPORTCH
    Direction% = DIGITALOUT

    Ulstat = cbDConfigPort(BoardNum, PortNum%, Direction%)
    If Ulstat <> 0 Then Stop


End Sub

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

VB6 examples are included with the InstaCal installation from the MCC DAQ Software CD. The typical location is ..\Public\Documents\Measurement Computing\DAQ\VBWIN\. The easiest way to augment your program would be to create a BoardNum1 and BoardNum2 variable and assign them the board numbers assigned by InstaCal.  Then, all you have to do is duplicate the various functions, like cbDConfigPort and DOut, DIn, DBitOut, or DBitIn that you may be using.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...