# IALabs Scripting Module Add modbus Device with addresses

**URL:** <https://forum.inductiveautomation.com/t/ialabs-scripting-module-add-modbus-device-with-addresses/9026>\
**Category:** 3rd Party Modules\
**Created:** [September 8, 2014, 4:07pm UTC](https://forum.inductiveautomation.com/t/ialabs-scripting-module-add-modbus-device-with-addresses/9026 "2014-09-08T16:07:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![d3h637](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@d3h637](https://forum.inductiveautomation.com/u/d3h637)\
**Post date:** [September 8, 2014, 4:07pm UTC](https://forum.inductiveautomation.com/t/ialabs-scripting-module-add-modbus-device-with-addresses/9026/1 "2014-09-08T16:07:39Z")

</div>

Is there a way to add the Modbus add the addresses to my Modbus device using the sys.device.addDevice? I successfully added a Modbus device using the module, but now I want to add the device addresses to the device. I don’t see a way to do that.

---

<div class="post-metadata">

**Author:** ![Amarth](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarth/32/3313_2.png) [@Amarth](https://forum.inductiveautomation.com/u/Amarth)\
**Post date:** [May 29, 2015, 8:16am UTC](https://forum.inductiveautomation.com/t/ialabs-scripting-module-add-modbus-device-with-addresses/9026/2 "2015-05-29T08:16:01Z")

</div>

Did you figure how to add the addresses to your modbus device ?

I’m also interested in creating and defining new devices by scripts.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 29, 2015, 12:44pm UTC](https://forum.inductiveautomation.com/t/ialabs-scripting-module-add-modbus-device-with-addresses/9026/3 "2015-05-29T12:44:12Z")

</div>

You don’t actually need to do that to access the data in the device. Just use the [addTag](https://support.inductiveautomation.com/usermanuals/ignition/system_tag_addtag.htm) scripting function with the appropriate address. If you look at the Address Mapping section [here](https://support.inductiveautomation.com/usermanuals/ignition/addressing.htm), you can see that adding the mappings for OPC browsing is a convenience, not a requirement.

---

<div class="post-metadata">

**Author:** ![antoniosantos\_ccb](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@antoniosantos\_ccb](https://forum.inductiveautomation.com/u/antoniosantos_ccb)\
**Post date:** [August 26, 2017, 12:10pm UTC](https://forum.inductiveautomation.com/t/ialabs-scripting-module-add-modbus-device-with-addresses/9026/4 "2017-08-26T12:10:43Z")

</div>

Please, give us an example.  
I need to access the Modbus devices datas (bits 0, 1, 2, 3, 4, 5, 6, 7, 8). I can’t.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 26, 2017, 6:08pm UTC](https://forum.inductiveautomation.com/t/ialabs-scripting-module-add-modbus-device-with-addresses/9026/5 "2017-08-26T18:08:12Z")

</div>

You’ll have to be more specific. See the addressing guide [here](https://docs.inductiveautomation.com/display/DOC79/Modbus+Addressing). Note that the modbus protocol doesn’t have any functions for accessing individual bits of 16-bit registers. You’ll have to read the entire register and extract the bits you want with boolean operations or the [getBit() expression function](https://docs.inductiveautomation.com/display/DOC79/getBit), and merge booleans into integers to write back. See [binEnc()](https://docs.inductiveautomation.com/display/DOC79/binEnc) for that.
