# getBit function

**URL:** <https://forum.inductiveautomation.com/t/getbit-function/12032>\
**Category:** General Discussion\
**Created:** [August 12, 2016, 5:59am UTC](https://forum.inductiveautomation.com/t/getbit-function/12032 "2016-08-12T05:59:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![P11](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@P11](https://forum.inductiveautomation.com/u/P11)\
**Post date:** [August 12, 2016, 5:59am UTC](https://forum.inductiveautomation.com/t/getbit-function/12032/1 "2016-08-12T05:59:18Z")

</div>

Good morning everybody from Italy,

I anticipate you I am not an expert about informatic, since I’m a chemical engineer.

I have a problem with the function getBit.  
The two parameters in this function are the number and the postion.  
Is the number the n-th bit in a word for example ? Is the position the tag path ?

I have to get a bit from a word, cause there is an alarm condition in it.

Thank you in advance for your help.

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [August 12, 2016, 1:57pm UTC](https://forum.inductiveautomation.com/t/getbit-function/12032/2 "2016-08-12T13:57:36Z")

</div>

Looks like [the docs](https://docs.inductiveautomation.com/display/DOC/getBit) could use some improving…

The number is the number you want a bit from, and position is the position of the bit in that number when it’s written in binary. For the second example in the docs (I’m going to just use 4 bits here for simplicity), the input number is 1, which is 0001 in binary. Counting from the right (least significant bit), position 0 is the 1 in 0001.

---

<div class="post-metadata">

**Author:** ![P11](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@P11](https://forum.inductiveautomation.com/u/P11)\
**Post date:** [August 12, 2016, 2:31pm UTC](https://forum.inductiveautomation.com/t/getbit-function/12032/3 "2016-08-12T14:31:48Z")

</div>

So I do not have to use it. I want simply get a bit from a word. for example DB1000,W3. From that word I want find the 1st bit (W3.1) . What I must do ?

---

<div class="post-metadata">

**Author:** ![P11](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@P11](https://forum.inductiveautomation.com/u/P11)\
**Post date:** [August 13, 2016, 11:18am UTC](https://forum.inductiveautomation.com/t/getbit-function/12032/4 "2016-08-13T11:18:02Z")

</div>

I think I have understood, I have to put as number the tag value, and as position the bit I want to get, is it right ?
