LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using DAQ mx for digital I/O

Hi,

I created a LabView program in LabView 7.0 that wrote to and read from the digital I/O lines of a PCI DIO96 card.

I recently upgraded the machine to Mac OS 10.3 and LabView 7.1.

There are'nt the same write to and read from digital line/port functions in LV7.1 so I downloaded NI-DAQmx Base as recommended.

Having installed DAQmx I ran the 'lsdaq' program and it came up with a device list but instead of listing a DIO96 card which I'm sure is what is installed, it came up with NI 6508 - Dev1 (see attached screen shot). Why? - Any ideas?

Now in the LabView functions menu I have NI DAQmx Base - Data Acqusition palette. From here I've selected the NI-DAQmx Base Read function but when I create a constant on the channel input there's nothing listed as though no card has been recognised.

Do I have to use the Create Virtual Channel function first?

Is there a clear write up of how to use these functions somewhere on the NI website?

Can I use these functions to read/write from/to a single line rathere than a whole port?


Thanks,
Dave
0 Kudos
Message 1 of 5
(3,094 Views)
I've had a look at all of these questions for you and now have the answers to them all. Firstly, what you are seeing in lsdaq is the PXI version of your DIO-96 card rather than the PCI version. Whilst this is strange, it shouldn't cause you any problems as the pinouts for both devices are the same. If you can communicate with the device then I wouldn't worry about it for now. I will forward this behaviour to our R&D department so that they can check this out.

As for configuring the channels, the recommended process is to first dynamically create the task using the 'Create Task' function and then use the 'Create Virtual Channel' function. This should allow you to correctly select the channels from your device.

When installing the driver, some examples should have been installed, giving you a place to get started from with the DAQmx base functions. By default these should have been installed in the /examples/daqmxbase directory. The best place to look for help with the functions in the DAQmx base driver would be the help files that are installed with the driver, which should be accessible from the LabVIEW help menu.

I hope that this information helps, please reply if you have any further questions or cannot get the device to work correctly

Hannah
Applications Engineer
NI
0 Kudos
Message 2 of 5
(3,065 Views)
Hi Hanah,

Thanks for your help. I really appreciate you getting back to me.

I've been looking through some of the examples that were installed with DAQ mx package and from this I've managed to create a prototype program (attached) to write to the DIO96 card.

I've got a few more queries you may be able to answer:

1. It seems a complex way compared to the (relatively) simple read and write to digital port/line functions that were in LV7.0, why the extra complexities?

2. Can you recomend any documentation to explain about this 'task' aproach? It's all new to me.

3. One of the parameters to the "DAQmxBase create virtual channel" vi is "Lines". When I create a constant for this and click on the drop down there is a browse option but even though the card is recognised in the IsDaq program nothing appears here. Instead I type in "Dev1/port0" and I get values on the the output lines as expected. If I use "Dev1/port0/line0" it runs ok with no error but it still writes to the whole 8bit port rather than just line0 of it. Is it no longer possible to write to a single line?

4. If it is not possible to create a task for an indivdual line of a port, is it possible to get from the task the last 8bit value written to it so as bitwise operations can be performed to switch individual lines but leave others as they are (for control lines chip-select, chip-enable, etc.) ?

5. In the C programming language you can create a static local variable in a sub routine that holds on to the its value from when it was last called. Is there any way of doing this with indicator/control values in sub vi's ? Such that they can be relied upon to hold the value from the last time they were called from the main vi?


Many thanks,
Dave,
Lancaster University.
0 Kudos
Message 3 of 5
(3,059 Views)
Hi Dave,

Sorry for the delay in getting back to you, I think I now have all the information that you need. I'll answer the questions you asked in order.

1: The functions of NI-DAQ changed between versions 7.0 and 7.1 for users on Macintosh partly to bring the drivers in line across operating systems, National Instruments is trying to get all users on to the NI-DAQmx part of the driver. Also the large changes in the Mac operating system forced a re-design of the driver.

2: The readme file is a good source of information, this describes how to create tasks and why. Also the 'Getting Started Guide' that installs as part of the documentation has a section on creating and configuring tasks.

By adopting this method of creating a task, you can setup the measurement channels with extra information, such as timing or triggering. You will need to create the task, either using the method I described earlier, using the 'Create Task' function, or, you can use the 'NI-DAQmx Base Configuration Utility' (installed as part of the driver). Using this utility should populate the task constant you described with the tasks that you have created, allowing you to bypass the use of the 'Create Task' function.

3: In this version of the driver, it is currently not possible to read from/write to individual lines of a port. Only the read/write of the whole port is supported.

4: In order to keep track of the values being written out, if you are using the same sort of while loop method to write data out as in your example, you can create a shift register. Do this by right clicking on the border of the while/for loop and select 'Create Shift Register' this will add a black terminal on the right and left hand side of the while/for loop. If you wire the data that you are writing out into the right hand terminal as well as the DAQmx function, this information will be passed through to the next iteration of the loop, and will be available at the left hand terminal. This will allow you to perform the bitwise operations you require.

5: There is a similar method to that described in point 4 that can be used within a subvi to act as as global variable, called a functional global variable. The shift register will keep hold of the values whilst in memory. I have included a link to an example which shows you how to do this. It also shows how to use the built in global variables with LabVIEW.

I hope that this information is useful to you, if you have any further questions, please feel free to ask.

Regards

Hannah
NI
0 Kudos
Message 4 of 5
(3,039 Views)
The link to the example

http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3E42D56A4E034080020E74861&p_node=DZ52029&p_source=External

Hannah
0 Kudos
Message 5 of 5
(3,038 Views)