I've run into 2 matters that I am trying to overcome as described below. All other functions are executing as expected.
(I'll show specific lines of code after stating the issues.)
Matter 1
A. Upon power-up of the 1024, all pins of PortA and PortB (the only 2 I'm using) measure approx +5V as is expected. But when I configure PortA for output all those pins are set low which is a problem for my application. I want them to remain high level until my program directs the pins to go high. At this time, the pins on PortB remain high level.
B. Even if my code immediately sets PortA pins for high output, they are all set low again when PortB is configured for output, and at that time PortB outputs are all set low as well.
So my 1st question... Is there a way to construct a vb code line such that the pins remain at default high level (+5V) when configuring the Ports for output? Below are the lines of code being used. The moment the 3rd line of code is executed the outputs go to low state as described above.
PortNum = MccDaq.DigitalPortType.FirstPortA
Direction = MccDaq.DigitalPortDirection.DigitalOut
ULStat = DaqBoard.DConfigPort(PortNum, Direction)
Matter 2
It seems that when ULStat error occurs, it generates a message box kind of description of the error and a following VB MsgBox error dialogue message box is ignored. I suspect I have omitted some requisite line of code but don't know what that might be.
In the declarations is this line of code (taken from the examples):
Dim r As Microsoft.VisualBasic.MsgBoxResult
Then in the various subs I have something along the lines of:
If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then
r = MsgBox("Invalid Board Number", MsgBoxStyle.Critical, "USB-1024LS not detected.")
Exit Sub
End if
Question
Mikd
I've run into 2 matters that I am trying to overcome as described below. All other functions are executing as expected.
(I'll show specific lines of code after stating the issues.)
Matter 1
A. Upon power-up of the 1024, all pins of PortA and PortB (the only 2 I'm using) measure approx +5V as is expected. But when I configure PortA for output all those pins are set low which is a problem for my application. I want them to remain high level until my program directs the pins to go high. At this time, the pins on PortB remain high level.
B. Even if my code immediately sets PortA pins for high output, they are all set low again when PortB is configured for output, and at that time PortB outputs are all set low as well.
So my 1st question... Is there a way to construct a vb code line such that the pins remain at default high level (+5V) when configuring the Ports for output? Below are the lines of code being used. The moment the 3rd line of code is executed the outputs go to low state as described above.
PortNum = MccDaq.DigitalPortType.FirstPortA
Direction = MccDaq.DigitalPortDirection.DigitalOut
ULStat = DaqBoard.DConfigPort(PortNum, Direction)
Matter 2
It seems that when ULStat error occurs, it generates a message box kind of description of the error and a following VB MsgBox error dialogue message box is ignored. I suspect I have omitted some requisite line of code but don't know what that might be.
In the declarations is this line of code (taken from the examples):
Dim r As Microsoft.VisualBasic.MsgBoxResult
Then in the various subs I have something along the lines of:
If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then
r = MsgBox("Invalid Board Number", MsgBoxStyle.Critical, "USB-1024LS not detected.")
Exit Sub
End if
But the VB msgbox never appears.
Thanks in advance for assistance.
- Mikd
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