Jump to content
  • 0

USB-1808X using digital input


PhilipW

Question

I’m using the USB-1808X. On the device there are labels for DIO0, DIO1 and GND. I assume that the label refer to digital input 0, digital input 1 and ground.

 

Within the code

 

short[] channelArray = null;

MccDaq.ChannelType[] channelTypeArray = null;

int numberOfDigitalChannels = 1;

 

channelArray = new short[numberOfDigitalChannels];

channelTypeArray = new MccDaq.ChannelType[numberOfDigitalChannels];

 

channelTypeArray[0] = MccDaq.ChannelType.Digital;

channelArray[0] = 0;  // port 0

 

When I call daqBoard.DaqInScan(), I get the exception message “Invalid digital port number”

Is there no port 0?

 

If I use

channelArray[0] = (short)MccDaq.DigitalPortType.AuxPort;  // port 1

 

calling daqBoard.DaqInScan() is successful.

 

I noticed that for enumerated type DigitalPortType, there is no enumeration whose value is 0.

 

How do I access digital Input 0?

 

    public enum DigitalPortType

    {

        AuxPort = 1,

        AuxPort0 = 1,

        AuxPort1 = 2,

        AuxPort2 = 3,

        FirstPortA = 10,

        FirstPortB = 11,

        FirstPortC = 12,

        FirstPortCL = 12,

        FirstPortCH = 13,

        SecondPortA = 14,

        SecondPortB = 15,

        SecondPortCL = 16,

        SecondPortCH = 17,

        ThirdPortA = 18,

        ThirdPortB = 19,

        ThirdPortCL = 20,

        ThirdPortCH = 21,

        FourthPortA = 22,

        FourthPortB = 23,

        FourthPortCL = 24,

        FourthPortCH = 25,

        FifthPortA = 26,

        FifthPortB = 27,

        FifthPortCL = 28,

        FifthPortCH = 29,

        SixthPortA = 30,

        SixthPortB = 31,

        SixthPortCL = 32,

        SixthPortCH = 33,

        SeventhPortA = 34,

        SeventhPortB = 35,

        SeventhPortCL = 36,

        SeventhPortCH = 37,

        EighthPortA = 38,

        EighthPortB = 39,

        EighthPortCL = 40,

        EighthPortCH = 41

    }

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hello @PhilipW.

For the USB-1808 Series, the Universal Library Help indicates that AUXPORT is the digital ChanArray for the DAQ Input function.  (Note: For digital scanning, the entire digital port must be configured for either input or output when scanning.)  The AUXPORT supports four digital I/O lines (four bits configurable).  You must read the entire port and then break apart the value to determine each digital input channel's value.

image.png

 

image.png

 

Regards,

Fausto

Link to comment
Share on other sites

  • 0

To clarify, a digital port (AUXPORT) consists for 4 digital I/O lines. For the USB-1808X there are 4 screw terminals labelled DIO0, DIO1, DIO2 and DIO3. By default each I/O line has four bits.

The maximum value for the digital port is 16 bits = 2^16 - 1 = 65,535 ?
Can I configure the number of I/O lines are in digital port ?
Can I configure the number of bits in an I/O line ?

Could I configure AUXPORT to only use DIO0 and DIO0 have 16 bits?

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