LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

question about: digital port write

Sorry for my ignorance,
I've been working with someone else writing a VI that controls a humidity sensor via a daq card connected to a terminal block using the digital io's.
I've used the context help to try an understand what line mask and pattern do, but I wasn't able to fully understand what it does. I really appreciate an example or a link to a wiki, thank you!

0 Kudos
Message 1 of 9
(3,011 Views)

Are you using traditional DAQ or DAQmx??

Anyhow, just browze LabVIEW examples and you will find sufficient examples for controlling/reading DIO's for both device drivers

Regards

Dev

 

 

0 Kudos
Message 2 of 9
(3,003 Views)
here http://forums.ni.com/ni/board/message?board.id=170&message.id=137823#M137823
 
is a link to a llb that might help you writing your code.
 
PS: Sensirion sensor?
 
 
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 3 of 9
(2,997 Views)
Why yes it is a sensirion
0 Kudos
Message 4 of 9
(2,980 Views)

Sounds like traditional NI-DAQ, right?

Both 'line mask' and 'pattern' are integers that are bit-mapped to the digital port.  You can choose to display both numeric values in binary to help illustrate the behavior.  So bit 0 is the 1's position, bit 1 is the 2's, bit 2 is the 4's, ..., bit n is the (2**n)'s position.

The behavior is that when you are writing to the port, the value of the particular bit in both 'line mask' and 'pattern' work together to determine what actually comes out of the board.  Specifically, when the 'line mask' bit is set to 1, the 'pattern' bit will be written.  When the 'line mask' bit is set to 0, the 'pattern bit' will be ignored and the output will remain at its present state.

-Kevin P.
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 5 of 9
(2,975 Views)

Line mask and pattern are "ANDed" together to determine which bits will be sent out.  Here is an example:

Lets say you have a certain pattern that you want to send, 4 bits at a time.  The pattern is 0101 0101.  In your first write, set the line mask to 0000 1111.  When the line mask and pattern run through the AND gate that is internal to the function, the output will be xxxx 0101, where xxxx is the previous state.   In the second write, set the mask to 1111 0000.  The output will be 0101 xxxx.  Since the previous output was xxxx 0101, the final output will be 0101 0101.

This is useful if you have a set pattern to send out, and you want to just send certain bits at a time.  You don't have to manipulate the pattern and stand a chance of changing it unintentionally.  Just change the line mask, and the pattern remains unchanged.

 

Message Edited by tbob on 01-20-2006 11:40 AM

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 9
(2,970 Views)
Can someone help me implement the 'ack' portion..
I am attaching the VI as well as transmission start sequence to make sure I am doing it right.

Download All
0 Kudos
Message 7 of 9
(2,962 Views)
From the attached Picture, It seems that bits 7 and 8 are written to no?
Ideally, I need to write to bits 6 7 and read off 5.

Message Edited by GHernandez on 03-07-2006 01:58 PM

0 Kudos
Message 8 of 9
(2,890 Views)
Are you counting your bits starting from 0 or 1?  Normally the count starts with 0.  Reading the bits from Right to Left, you would have bit 0, then bit 1, etc (76543210).  The line mask would then show that bits 6 and 7 were being written.  To read bit 5, read in the entire byte, then AND it with 00100000.  Take the result and right shift by 5 bits to get a numeric result.   Use the comparison function Not Equal to Zero on the AND output to get a boolean result (no shifting).
- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 9
(2,874 Views)