PhilipW Posted June 24 Posted June 24 The USB-1808X has 4 I/O ports. It can be configured for input or output but not both. The maximum number of ports is 4. Using your sample program DaqOutScan01, the method DIOProps.FindPortsOfType() always returns 1 for the number of availalble ports. Here is the code from the sample program: // determine the number of digital ports, their capabilities, etc ChannelType = clsDigitalIO.PORTOUTSCAN; NumPorts = DIOProps.FindPortsOfType(DaqBoard, ChannelType, out ProgAbility, out PortNum, out NumBits, out FirstBit); Questions: 1. How can I get the method DIOProps.FindPOrtsOfType() to return 2, 3 or 4 available ports? 2. If configuring for digital output, what is the maximum value for each port?
0 DAQman Posted June 25 Posted June 25 The USB-1808X has one 4-bit scan port, so FindPortOfType returns 1. The port type is AUXPORT and can be configured for output as follows: cbDConfigPort(DaqBoard, AUXPORT, DIGITALOUT); Update the port with: cbDOut(DaqBoard, AUXPORT, x); x is an unsigned short with a value of 0 to 15 or cbDBitOut(DaqBoard, AUXPORT, bitNum, x); x = 1 or 0 cbDaqOutScan streams data to both analog and digital outputs. If all you require is to output to the digital port, use cbDOutScan because it is easier to use than cbDOutScan. If you need cbDaqOutScan, it takes a channel, gain, and type array. The channel is AUXPORT, the gain is BIP10VOLTS but is ignored, and the type is DIGITAL. You can find all this in the UL Help, specifically on the USB-1808X page. This is a comprehensive resource that will provide you with all the necessary information.
0 PhilipW Posted June 25 Author Posted June 25 I think I am confusing ports with lines. Am I correct to think AUXPORT supports the four digital I/O lines (terminals DIO0, DIO1, DIO2, DIO3) on USB-1808X? For DaqOutScan(), the buffer holding the data (memHandle) is 16-bit data. Does this mean first 4 bits of the first byte go to DIO0? The second 4 bits of the first byte go to DIO1? The first 4 bits of byte 2 go to DIO2 and the second 4 bits of byte 2 go to DIO3? The values from each DIO line is from 0 - 15?
0 DAQman Posted June 25 Posted June 25 AUXPORT supports the four digital IO lines. The max value of a 16-bit word is 65535, which is equivalent to 1111 1111 1111 1111 binary or 0xFFFF hexadecimal. The first four bits are written to the four digital IO lines the rest are ignored. For example, writing 0x000F (15 dec) or 0x00FF (255 dec) sets all four lines high. Writing 0x000A (1010 binary) sets every other line high. Only a few customers use DaqOutScan, so I'm curious why you chose to use it.
0 PhilipW Posted June 27 Author Posted June 27 Hi JRys, I am writing a C# application that uses the USB-1808X to receive data from a PLC application. Data is received from the PLC application using three analog inputs and a counter. I am using DaqInScan() with the options BACKGROUND and CONTINUOUS. To send a signal back to the PLC application, I need to send a continuous stream of 0s or 1s on digital output lines DIO0 and DIO1. I chose DaqOutScan() since it compliments DaqInScan(). Your last message suggests there is a better method than DaqOutScan(). What method is better?
0 DAQman Posted June 28 Posted June 28 DaqOutScan is used if you want to output both analog and digital. Since you will be doing only digital, use the DOutScan. Use port type AUXPORT. Use WinBufAllocEx() to create a 16-bit buffer. Create a UInt16 buffer and load it with your data. The upper 12 bits are ignored. Use WinArrayToBuf() to transfer the UInt16 buffer to the driver buffer. Please let me know if you need help.
Question
PhilipW
The USB-1808X has 4 I/O ports. It can be configured for input or output but not both. The maximum number of ports is 4.
Using your sample program DaqOutScan01, the method
DIOProps.FindPortsOfType() always returns 1 for the number of availalble ports.
Here is the code from the sample program:
// determine the number of digital ports, their capabilities, etc
ChannelType = clsDigitalIO.PORTOUTSCAN;
NumPorts = DIOProps.FindPortsOfType(DaqBoard, ChannelType, out ProgAbility, out PortNum, out NumBits, out FirstBit);
Questions:
1. How can I get the method DIOProps.FindPOrtsOfType() to return 2, 3 or 4 available ports?
2. If configuring for digital output, what is the maximum value for each port?
5 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