LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

digital line write 6024E

I've been going through the posts related to this problem for the last 9 hours and I'm still no closer to having a solution.

I'm trying to read a digital input on one line (Line 0) and write to several digital outputs (when appropriate) on the same port.

I've tried using the advanced controls and configuring the ports individually. I've tried using different constants on the iteration variable.

The best results I've had so far give me constant flickering on all IO in the port.

If I could just get a simple version working; One digital read and one digital write on the same port, I could probably figure the rest out. But so far, none of the examples I've seen have been able to help me with this.

Any advice would be greatly appreciated.
---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 1 of 7
(3,205 Views)
Usually you configure lines for input or output in groups of 8 bits. I don't think you can read from bit 0 and then write to bit 1 thru 7 without reconfiguring the device. You can't configure bit 0 for input and bit 1-7 for output at the same time. I would suggest you group your bits into 8, and configure group 1 (bits0-7) for input, even if you use only one bit. Group 2 would be bits 8-15, configure for output. If you have to use the same port, you have to re-configure for input or output before reading or writing. But how does the device you are connected to handle this?
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 7
(3,200 Views)
Thanks for the reply tbob.

I think I may have found the solution through one of NI's examples though. The Dig Multi-line Direction (E).vi example shows how to configure a single port for both Read bits and Write bits.

This is very handy if you only have a few IO and especially handy if you only have one digital port.

The problem was with the DIO Port Config.vi

Both the Read from Digital Line.vi and the Write to Digital Line.vi contain the DIO Port Config.vi and will call it every time they execute. This resets the configuration on ever iteration and causes all kinds of problems if the two higher level vi's are used together in the same loop.

The E-Series Cards do allow you to mix IO within a port. It just took me a little time to understand how that worked.
---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 3 of 7
(3,190 Views)
Beware when using the same port for read and write. Sometimes I use the write function to output a signal to activate a relay. When re-configuring the port to read, that relay may no longer be activated, which could cause some testing errors. However, if the E series allows you to configure individual bits instead of an entire port, that might be OK. I am not familiar with E series.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 7
(3,178 Views)
I would suggest doing this in DAQmx. Check out the attatched code. It sets up two tasks; one for input and one for output. Using DAQmx will make your code more portable in the future since Traditional DAQ will be phased out and new devices will only support DAQmx.

-Sal
Message 5 of 7
(3,157 Views)
Thanks for the advice Salvador.

If I use the DAQmx .vis for digital IO, will I not also need to change all of my Traditional DAQ vis to DAQmx?

I've noticed some troubles with my hardware when switch between the two types. Is it possible to use both Traditional and DAQmx within the same Top Level vi?
---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 6 of 7
(3,154 Views)
Hi Pallen,

Yes, you will need to switch all of your traditional programming to DAQmx. DAQmx and Traditional can NOT run simultaneously on the same board. You also need to reset the device when switching between them.

Programming in DAQmx is HIGHLY suggested. DAQmx is simpler to program and the driver for it is newer than traditional. Also, all of our new boards will support DAQmx as traditional DAQ is phased out. Eventually, everything will be in DAQmx so it is recommended that customers start moving their code over to DAQmx and avoid writing new code in traditional.

Thanks,
Sal
0 Kudos
Message 7 of 7
(3,138 Views)