Jump to content
  • 0

USB-1024LS and VB Express 2008 Questions


Mikd

Question

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

  • 0

OK. I've been able to resolve the second matter.
But still wanting to know if there is a means to configure a Port to digital output without it causing the pins of other digital output ports to low level.
For example:
1. Configure PortA for digital output. Causes all pins on that port to low state.
2. Set specific pins of PortA to high state.
3. Set a different port (PortB, PortCl, or PortCh) to digital output. Causes all pins of that port to low state.
BUT... It also sets all pins of PortA back to low state.
I am trying to prevent pins of PortA and Port B to be simultaneously at low level state.

This occurs at execution of the last of these 3 code lines:
        PortNum = MccDaq.DigitalPortType.FirstPortB
        Direction = MccDaq.DigitalPortDirection.DigitalOut
        ULStat = DaqBoard.DConfigPort(PortNum, Direction)

Other than this, all seems to work as expected. Any of the digital output pins can be programmatically set to low or high state

The USB-1024LS is operating with Ver 1.01.

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...