LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

declare labview data word

Hi there,

I am a new user on labview. Previously a PLC programmer.

I wish to know or is there a sample program for the steps below.

1) declare a local word variable

2) use (read & write) individual bit from the word for programming

 

adrian

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

Hi huikim,

              what you are trying to achieve is,you are entering a word into a string control and after running the VI you have to display it in an indicator.Is it??

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
0 Kudos
Message 2 of 9
(3,132 Views)

hi danil33,

would like to individually change the bit status of a word variable.

example, first i need to create a word variable. The i want to change the bit3 of the word from 0 to 1. i.e. 1 word =8bits i.e. bit7, bit 6,.... bit1, bit0.

How can i create the local word & change the status of the bit?

 

0 Kudos
Message 3 of 9
(3,124 Views)

Hi huikim,

 

               From your explanation I think you are trying to achieve this.If not please tell.

 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
0 Kudos
Message 4 of 9
(3,118 Views)

Hi Danil33,

It's not what i actually wanted but thanks for the support anyway. i'll try to figure it out first.

Thank you

0 Kudos
Message 5 of 9
(3,113 Views)

@huikim wrote:

Hi there,

I am a new user on labview. Previously a PLC programmer.

I wish to know or is there a sample program for the steps below.

1) declare a local word variable


There are no variables in LabVIEW. While you can create "local variables", they are a misnomer. They are actually more like shadow copies of front panel controls/indicators. You can create constants. Perhaps this is what you are looking for.

 


2) use (read & write) individual bit from the word for programming

Boolean functions can be used to do this. They can operate on integers just as well as Booleans. For example, if you have an integer datatype, like an I8 (8-bit integer). You can find out if the 3rd bit is set by simply ANDing it with the value of 4 and seeing if the result is greater than zero (if you want a Boolean yes/no).

 

To set a bit you'd OR with the appropriate mask (i.e., a mask that has only a 1 at the position you want to set and everything else a 0).

To clear a bit you'd AND with the appropriate mask (i.e., a mask that has a 0 at the position you want to clear and everything else a 1).

0 Kudos
Message 6 of 9
(3,085 Views)

Thanks for the information,  

I also thought of this method & will try to play around with LabView.

 

One more request. Do you have the instruction list for LabView. List each instruction/module with details desciption & function?

 

0 Kudos
Message 7 of 9
(3,052 Views)

Hi huikim,

 

there's the great context help, also available as online help...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(3,042 Views)

Since it sounds like you are very new to LabVIEW, you might want to look at some of the online tutorials.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 9
(3,025 Views)