LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dig Out line

Hi guys,

 

I'm new to sending Digital output, I usually use analog.  I have some old VB code which has statements like DIG_Prt_Config(1, 8, 0, 1) and  DIG_Out_Line 1, 8, 6, 1.  I have the traditional DAQ and DAQmx, but I can't see to figure out how those lines ofVB code translate into LabVIEW code.  I'm guessing that the (1, 8, 0, 1) correspond to (dev, line, ? , ?), what are the last to inputs?  The Write to Digital Line subvi only takes in three parameters, device, digital channel, and line so I am kind of confused.

 

Cheers,

Shivels  
.

0 Kudos
Message 1 of 9
(4,415 Views)

I think (1, 8, 0, 1) correspond to (dev, Port no, Line no , data to be written)

 So it says that write "1"(TRUE) on line 0 of Port 8 of DEVICE='1'.

 

Hope this helps.Kudos are welcomed.:-)

0 Kudos
Message 2 of 9
(4,405 Views)

You should just look up the functions in the Traditional NI-DAQ (Legacy) C Function Reference Help. For example:

 

DIG_Prt_Config (deviceNumber, port, mode, dir)

DIG_Out_Line (deviceNumber, port, line, state)

0 Kudos
Message 3 of 9
(4,397 Views)

Thanks for the info guys, I think I'm starting to piece it together.  I tried wiring up a command to turn on the device, but I am still having trouble.  In the attached vi, I am trying to send the command 1,8,6,1 (which turns the device on) to the device, but it doesn't work.  The vi does not return any errors, it just doesn't turn on the device.  I know the device works because the VB code can turn it on remotely. Is there possibly something wrong with my line pattern or mask?

 

Cheers,

Shivels

0 Kudos
Message 4 of 9
(4,372 Views)

I think your problem is that you have an 8 wired to the digital channel input.  The port width input is not wired, and the default is 8.  So if the port is 8 bits wide, the channels will be 0 through 7.  There is no channel 8.  I think you should wire a 0 into the digital channel input if you are using channel 0 as an output.

 

Also, instead of using -1 as an input to line direction map, it is much easier to understand if you would convert this to a binary representation to see which lines go in which direction, similar to the line mask input.  If you are writing to just one channel, don't use -1 as the data pattern to write.  Just use a 1 if outputing on channel 0.  If outputing on 8 channels, use 255, or better yet, change this representation to a binary format.  Makes it easier to see which port gets which data.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 9
(4,350 Views)

Thanks to you guys, I have been able to figure out what needs to be done but I am having trouble applying it.  I have decided to use DAQmx instead of the DIG vi's to bring the software upto date.  For some reason, I can't seem to get it to work.  The vi executes and returns no errors, but the machine still does not come on.  I have attached the vi I am using to communicate with the device.  It's got to be something very simple I am missing, but I can't seem to find it.  Thanks for all the help!

 

Cheers,

Shivels

0 Kudos
Message 6 of 9
(4,332 Views)

The 'machine' does nt come on or the digital outputs are not responding? If you have something connected, disconnect and verify the outputs with the test panel in MAX and a DMM. If they work there, then the problem is not with the code or the card. Perhaps a wiring error or the card cannot souce enough current for what you are trying to drive. What DAQ card are you using?

0 Kudos
Message 7 of 9
(4,328 Views)

The machine doesn't turn on.  The DAQ card is an old PCI-DIO-96.  If I run the VB code, the machine turns on.  The VB code makes calls to the old legacey nidaq32.dll for the DIG_OUT_LINE (1,8,6,1) command.  Since the port width is 8, am I correct in sending a 24 element boolean array?  I'm having a little trouble understanding what the difference between writing Digital Bool 1line 1port and Digital 1D Bool 1Chan 1Sample.  If I send a bool array all TRUE to channel 8, that should set all line to high (11111111111111111111111111111111), right? Then if I want to change line 6 to low, would I send a FALSE value on Dev2/port8/line6 using Digital Bool 1line 1port vi? I just can figure out why it would work using VB calls to nida32.dll and not using DAQmx?

 

Cheers,

Shivels 

0 Kudos
Message 8 of 9
(4,310 Views)

It's all in how you define the task. The VB code is only setting one line so your task would have dev1/port8/line1 and you would use a Digital Bool 1 Line 1 Point where you write a Boolean scalar - not an array.

 

Don't see where a port (8 lines) would have 24 elements.

0 Kudos
Message 9 of 9
(4,303 Views)