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
Question
Creation Test Solutions
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
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 accountSign in
Already have an account? Sign in here.
Sign In Now