LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to split 8-bit port in smaller ports?

Hi, sorry newbie ~:
 
well, I am trying to write a VI for controlling some selectors by TTL logic for a  chemical lab application.
I have a PCI-6503 DIO card, which has 3 8-bit ports.
 
My selectors require at maximum 4 contacts and probably (in the future, I am developing my VI's in an open fashion, to
allow extensible use) more than 3 selector will be connected. The idea of splitting the 8-bit into 2 4-bit ports popped up
in my brain.
 
The LabVIEW (6.1) functions allow either writing to a whole port (or multiples of it) or to one single line of the port.
Writing to single lines will probably not assure the activation _at_the_same_time_ of the contacts, i.e. no TTL consistent result.
 
How can one write to small chunks of an 8-bit port simultaneously without changing the rest of the bits???
 
0 Kudos
Message 1 of 3
(2,800 Views)
Djovanny,
 
It's quite easy - in traditional DAQ the DIO Port Write VI has "pattern" and "line mask" inputs...
 
Create an integer "line mask" value where the bits/line positions you want to change are "1" and those you want to leave unchanged are "0".
 
Create an integer "pattern" value containing the states (0 or 1) of the lines you want to set/reset in appropriate positions (the value of the pattern bits/line positions corresponding to where your mask bits are 0 don't matter because they are masked from being changed).
 
In the attached example...
 
1.  I write a variable 4 bit value/code to the lower bits of an 8 bit port - but notice that sixth bit (bit 5) is always set by the process and the fith bit (bit 4) is not changed because it is masked by the 0 in the "line mask" value.
 
2. I then read some (test hardware) status register.
 
3. I then reset all the lower 4 bits and the sixth back to 0, but the fith bit is still left as is because the same "line mask is used.
 
Hope this helps?
 
Mark H.
0 Kudos
Message 2 of 3
(2,781 Views)
As my example is LV 7.0 and you have 6.1 - here's a picture of the main VI diagram (the DIO port write VI are within the diagram's sub VIs).
 
 
0 Kudos
Message 3 of 3
(2,773 Views)