Jump to content
  • 0

How to read all Port Values at once in USB 1024LS daq ?


Chandana Narayan

Question

I was trying to read values from Ports A, B and C using the DBitIn program from the C library example code provided.

Configuring the port is done using this function. err = getDioInfoFirstSupportedPortType(daqDeviceHandle, &portType, portTypeStr); Here by default the portType is read as FIRSTPORTA. So I have externally given portType values as FIRSTPORTB / FIRSTPORTCL/ FORSTPORTCH to get the ports configured. 

To read the bits,this function is used,err = ulDBitIn(daqDeviceHandle, portType, bitNumber, &data[bit_counter]). My requirement is to read all the port values at once. So to do that, I am first configuring FIRSTPORTA, then reading its bits. Later configuring FIRSTPORTB, then reading. Similarly for PORTC. Is this the only way to do it, or any better way to read all at once? Doing it port to port is tedious.

Attaching my code for reference , how I implemented it.

DBitIn.c

Edited by Chandana Narayan
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

getDioInfoFirstSupportedPortType is not part of the Universal Library, it is a utility function found only in the examples. The function to configure the direction of a port is ulDConfigPort(BoardNum, PortType, Direction). Your port types are FirstPortA, FirstPortB, FirstPortCL and FirstPortCH. To read an individual bit, use the ulDBitIn function with FirstPortA and bit numbers of 0 to 23. To read a port, use the ulDIn function and one of the four port types. It is not possible to read all four at the same time. The best you can do is to read them one after another. If you do this, expect a 10mS time skew between each read.

The following is a link to the Linx C UL Help for your device

https://www.mccdaq.com/PDFs/Manuals/UL-Linux/c/1024ls.html

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