LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple sequenced digital output

This is my first real venture into LV programming, though I've been programming in C,Perl, etc for years. 

I am running a PXI-6143 (which has 8 digital i/o channels) and the goal is to turn on and off some relays in a specific order over a period of a few seconds (this is just part of a larger program).  Each relay is tied to one bit of the dig i/o port (through a transistor and diode).  The hardware works just fine and I've been able to run simple VIs to set static pasterns of 1s and 0s on the port (using the DAQmx write examples).  If I were using a sequential programming language (where one command follows the last), I would simply output a binary value to the i/o port (i.e. 0b00000001), wait some number of milliseconds, change the output to another binary value (i.e. 0b000000010), wait, etc...  However, I have yet to figure out the "standard" way you would do this in LV.  I understand you don't want to use separate DAQmx writes,  instead you should just modify the input (through an array) to a single DAQmx write box.  However, it is the act of sequentially changing that array that has me stumped. I tried using a frame sequence, each frame having eight T/F constants, but couldn't figure out how to wire it up so that each frame changed the same bits in the array.   Any and all advise will be welcomed.

Thanks,

Zach
0 Kudos
Message 1 of 2
(2,492 Views)

It really doesn't matter that much whether you separate separate writes or not. A for or while loop while take up less diagram space. For and while loops exist in text languages too and they take up less lines of code there also.Smiley Wink

Here's a simple example that does it both ways. No need for a sequence structure when you have dataflow. It's just a modified version of one of the shipping examples called Write Dig Port. You can do this with Booleans as well. Look at Write Dig Chan.

Message 2 of 2
(2,489 Views)