LAVA: C++ bit fields in LabVIEW? - LAVA

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

C++ bit fields in LabVIEW? C++ bit fields in LabVIEW? Rate Topic: -----

#1 User is offline   c_w_k

  • Active
  • Pip
  • Group: Members
  • Posts: 20
  • Joined: 08-June 09
  • Location:Alton, IL
  • Version:LabVIEW 8.6
  • Since:2009

Posted 23 September 2009 - 10:49 PM

Hello,

I wondering how I can translate my C++ code that uses a "bit field", into LabVIEW code.....


I have a C++ structure that contains a field of data type short that is a bit field:

structure : status

short done; // completion flag, this is a bit field
// bit 0 is on when an acquistion is in progress
// bit 1 is on when the FIFO contains a complete coad
// bit 2 is on when a FIFO underrun has occured


I need to use the field in an if statement as follows:

if(ret == 0) && (status.done & 0x2)) -> this is the part I'm wanting to no how to do in LabVIEW......
{
//do whats needed....
}



Thanks
CK
0

#2 User is offline   Dan DeFriese

  • Very Active
  • PipPipPip
  • Group: Members
  • Posts: 163
  • Joined: 10-November 05
  • Location:Milwaukee, WI USA
  • Version:LabVIEW 8.6
  • Since:2004

Posted 23 September 2009 - 11:08 PM

Here are my approaches to bit twidding.

Dan

Attached thumbnail(s)

  • Attached Image

This post has been edited by Dan DeFriese: 23 September 2009 - 11:19 PM

0

#3 User is offline   Mellroth

  • Extremely Active
  • PipPipPipPip
  • Group: Members
  • Posts: 411
  • Joined: 24-August 06
  • Version:LabVIEW 8.6
  • Since:1995

Posted 24 September 2009 - 06:04 AM

View PostDan DeFriese, on 24 September 2009 - 12:08 AM, said:

Here are my approaches to bit twidding.

Dan


I think the middle picture is wrong, should be using an OR operation instead.

Here is another way of doing the bit manipulation
Attached Image

Attached File  Bit manipulation.vi (7.4K)
Number of downloads: 24

/J
0

#4 User is offline   Dan DeFriese

  • Very Active
  • PipPipPip
  • Group: Members
  • Posts: 163
  • Joined: 10-November 05
  • Location:Milwaukee, WI USA
  • Version:LabVIEW 8.6
  • Since:2004

Posted 24 September 2009 - 12:20 PM

View PostMellroth, on 24 September 2009 - 01:04 AM, said:

I think the middle picture is wrong, should be using an OR operation instead.


Thanks Posted Image.
0

#5 User is offline   Mellroth

  • Extremely Active
  • PipPipPipPip
  • Group: Members
  • Posts: 411
  • Joined: 24-August 06
  • Version:LabVIEW 8.6
  • Since:1995

Posted 24 September 2009 - 01:24 PM

View PostDan DeFriese, on 24 September 2009 - 01:20 PM, said:

Thanks Posted Image.


You're welcome

/J
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic