07-02-2012 03:28 AM
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
07-02-2012 03:32 AM
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??
07-02-2012 03:55 AM
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?
07-02-2012 04:06 AM
Hi huikim,
From your explanation I think you are trying to achieve this.If not please tell.
07-02-2012 04:20 AM
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
07-02-2012 08:18 AM - edited 07-02-2012 08:28 AM
@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).
07-04-2012 12:46 AM
Thanks for the information, smercurio_fc
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?
07-04-2012 02:36 AM
07-04-2012 08:48 AM
Since it sounds like you are very new to LabVIEW, you might want to look at some of the online tutorials.