Visit our LabVIEW Wiki Hardware Portal
Tags |
(This content has not been tagged yet)
|
![]() |
Jul 31 2008, 03:15 PM
Post
#1
|
|||
|
Very Active Member Posts: 227 Joined: 19-August 05 From: Minneapolis, MN Member No.: 2786 Using LabVIEW Since:1995 LV:8.20 ,. ,.
|
In my app I need to control 16 digital lines individually. I was wondering if makes sense to setup 16 different digital output tasks where there's one channel for each line. Then to control a line I'd use the appropriate task when using DAQmx Write. Otherwise, if I setup the output as a port, then I'd either have to keep track of the output state for all the lines or read the state of the lines before ORing in the one line I need to control.
I'd appreciate any thoughts on which way makes more sense. George
|
||
|
|
|||
| Ad |
Jul 31 2008, 03:15 PM
Post
#
|
||
|
|
|
||
|
|
|||
Jul 31 2008, 04:24 PM
Post
#2
|
|||
![]() Extremely Active Member Posts: 509 Joined: 2-August 05 Member No.: 2680 Using LabVIEW Since:1996 LV:8.5.1 ,8.6 ,.
|
Might depend on the hardware you are using.. Low cost DAQ's may not allow the lines to be treated individually..
Why not try an example with two lines and tasks and if it works, go from there? Neville.
|
||
|
|
|||
Jul 31 2008, 05:13 PM
Post
#3
|
|||
|
Very Active Member Posts: 227 Joined: 19-August 05 From: Minneapolis, MN Member No.: 2786 Using LabVIEW Since:1995 LV:8.20 ,. ,.
|
Might depend on the hardware you are using.. Low cost DAQ's may not allow the lines to be treated individually.. Why not try an example with two lines and tasks and if it works, go from there? Neville. I'm using a PXI-6254. I've tried setting individual tasks for each line and it works fine. I'm just wondering that's a good way to go vs the other way I mentioned. George
|
||
|
|
|||
Jul 31 2008, 05:37 PM
Post
#4
|
|||
![]() Extremely Active Member Posts: 509 Joined: 2-August 05 Member No.: 2680 Using LabVIEW Since:1996 LV:8.5.1 ,8.6 ,.
|
I'm using a PXI-6254. I've tried setting individual tasks for each line and it works fine. I'm just wondering that's a good way to go vs the other way I mentioned. George Individual lines are always more flexible. You have more control, and don't have to remember the states of the other lines. Two caveats: 1 You have some logic that requires you to remember prev line states.. e.g: Line1 can only come ON if Line2 and Line3 are OFF..or something like that. 2 You have to carry around 16 separate task ID's. Neville.
|
||
|
|
|||
Jul 31 2008, 05:48 PM
Post
#5
|
|||
![]() Active Member Posts: 23 Joined: 28-July 08 From: CT Member No.: 12118 Using LabVIEW Since:2005 LV:8.5.1 ,. ,.
|
In my app I need to control 16 digital lines individually. I was wondering if makes sense to setup 16 different digital output tasks where there's one channel for each line. Then to control a line I'd use the appropriate task when using DAQmx Write. Otherwise, if I setup the output as a port, then I'd either have to keep track of the output state for all the lines or read the state of the lines before ORing in the one line I need to control. I'd appreciate any thoughts on which way makes more sense. George George -- In my head it seems simpler to keep track of a 16bit (U16) integer, holding all of your current states. Then apply OR's (or whatever) to the appropriate bit in the U16 variable.? (a little binary to decimal understanding is required, and I think that covers you) That way you have only 1 task. That would be better than 16 tasks. You would not have to read at all in this case,.. Also, is it even possible to have multiple tasks that are of the same type (on the device)? -Scott This post has been edited by ScottC: Jul 31 2008, 05:50 PM
|
||
|
|
|||
Jul 31 2008, 06:29 PM
Post
#6
|
|||
![]() CCT It Premium Member ![]() Posts: 1337 Joined: 13-June 05 From: Woerden, Netherlands Member No.: 2399 Using LabVIEW Since:2001 LV:8.5.1 ,6.1 ,8.2.1
My Blog
My Gallery
|
Also, is it even possible to have multiple tasks that are of the same type (on the device)? -Scott Yes, at least for non-timed tasks. Ton --------------------
|
||
|
|
|||
Aug 14 2008, 11:19 PM
Post
#7
|
|||
|
Very Active Member Posts: 55 Joined: 28-February 06 From: Michigan Member No.: 4274 Using LabVIEW Since:2005 LV:8.5.1 ,. ,.
|
I have run into this decision a few times. My final solution was to create a functional global with the following actions: Init, Write, Write Line, Read Status, and Close. A boolean array or single line was used for the input and a global virtual channel was used to specify multiple individual channels.
One "trick" that a few don't realize is that DAQmx Read can be used on output analog channels, digital ports, and digital lines! Note: This doesn't work on some devices or on simulated devices.
|
||
|
|
|||
![]() ![]() |
| Time is now: 3rd December 2008 - 08:45 AM |