I am testing my PMD-1024HLS (same as USB-1024HLS) PortA, PortB, PortCL, PortCH using VB.net. My code is shown below.
I am getting unexpected results when testing PortCH . The other three ports PortA, PortB, PortCL work fine in my test.
In my test, I use both DOut() and DIn() methods. I use DOut() to write a hex value and then DIn() method to read the value back what was written and compare it. Am I misunderstanding the PortC nibble of PortCL and PortCH? My question is at the bottom.
Thank you, Scott Mackey
'// My code starts here:
Private _daqBoard As MccDaq.MccBoard
Private _portA As Short '// Byte
Private _portB As Short '// Byte
Private _portCL As Short '// Nibble low
Private _portCH As Short '// Nibble high
Dim ULStat As MccDaq.ErrorInfo
Dim errPort As Boolean = False
_daqBoard = New MccDaq.MccBoard() '// Create instance with access to all methods
ULStat = _daqBoard.DConfigPort(FirstPortA, DigitalOut) '// Configure FirstPortA for output; all ports set low from this
If (ULStat.Value <> NoErrors) Then
errPort = True
End If
ULStat = _daqBoard.DConfigPort(FirstPortB, DigitalOut) '// Configure FirstPortB for output; all ports set low from this
If (ULStat.Value <> NoErrors) Then
errPort = True
End If
ULStat = _daqBoard.DConfigPort(FirstPortCL, DigitalOut) '// Configure FirstPortCL for output; all ports set low from this
If (ULStat.Value <> NoErrors) Then
errPort = True
End If
ULStat = _daqBoard.DConfigPort(FirstPortCH, DigitalOut) '// Configure FirstPortCH for output; all ports set low from this
If (ULStat.Value <> NoErrors) Then
errPort = True
End If
If errPort Then
Throw New Exception("Driver Board for AC Controller did not configure properly.")
End If
End Sub
'// PortA ** Works fine ***************************************************************
_portA = &HAA
Question
Scott Mackey
Hello,
I am testing my PMD-1024HLS (same as USB-1024HLS) PortA, PortB, PortCL, PortCH using VB.net. My code is shown below.
I am getting unexpected results when testing PortCH . The other three ports PortA, PortB, PortCL work fine in my test.
In my test, I use both DOut() and DIn() methods. I use DOut() to write a hex value and then DIn() method to read the value back what was written and compare it. Am I misunderstanding the PortC nibble of PortCL and PortCH? My question is at the bottom.
Thank you, Scott Mackey
'// My code starts here:
Private _daqBoard As MccDaq.MccBoard
Private _portA As Short '// Byte
Private _portB As Short '// Byte
Private _portCL As Short '// Nibble low
Private _portCH As Short '// Nibble high
'// ** Constructor **************************************************************************************************
Public Sub New(ByVal outlet As OutletType)
Dim ULStat As MccDaq.ErrorInfo
Dim errPort As Boolean = False
_daqBoard = New MccDaq.MccBoard() '// Create instance with access to all methods
ULStat = _daqBoard.DConfigPort(FirstPortA, DigitalOut) '// Configure FirstPortA for output; all ports set low from this
If (ULStat.Value <> NoErrors) Then
errPort = True
End If
ULStat = _daqBoard.DConfigPort(FirstPortB, DigitalOut) '// Configure FirstPortB for output; all ports set low from this
If (ULStat.Value <> NoErrors) Then
errPort = True
End If
ULStat = _daqBoard.DConfigPort(FirstPortCL, DigitalOut) '// Configure FirstPortCL for output; all ports set low from this
If (ULStat.Value <> NoErrors) Then
errPort = True
End If
ULStat = _daqBoard.DConfigPort(FirstPortCH, DigitalOut) '// Configure FirstPortCH for output; all ports set low from this
If (ULStat.Value <> NoErrors) Then
errPort = True
End If
If errPort Then
Throw New Exception("Driver Board for AC Controller did not configure properly.")
End If
End Sub
'// PortA ** Works fine ***************************************************************
_portA = &HAA
ULStat = _daqBoard.DOut(FirstPortA, _portA)
_portA = &H0
ULStat = _daqBoard.DIn(MccDaq.DigitalPortType.FirstPortA, _portA)
'// PortB ** Works fine ****************************************************************
_portB = &H55
ULStat = _daqBoard.DOut(FirstPortB, _portB)
_portB = &H0
ULStat = _daqBoard.DIn(MccDaq.DigitalPortType.FirstPortB, _portB)
'// PortCL ** Works fine ***************************************************************
_portCL = &HA '// xxxx|1010
ULStat = _daqBoard.DOut(FirstPortCL, _portCL)
_portCL = &H0 '// xxxx|0000
ULStat = _daqBoard.DIn(MccDaq.DigitalPortType.FirstPortCL, _portCL)
'// PortCH ** NOT READING BACK WHAT WAS WRITTEN *******************************
_portCH = &HA0 '// 1010|xxxx
ULStat = _daqBoard.DOut(FirstPortCH, _portCH)
_portCH = &H0 '// 0000|xxxx
ULStat = _daqBoard.DIn(MccDaq.DigitalPortType.FirstPortCH, _portCH) _portCH = 00H and not A0H
Link to comment
Share on other sites
1 answer 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