# Writing to Modbus from FX30

**URL:** <https://forum.sierrawireless.com/t/writing-to-modbus-from-fx30/30477>\
**Category:** Octave\
**Created:** [August 18, 2023, 9:10pm UTC](https://forum.sierrawireless.com/t/writing-to-modbus-from-fx30/30477 "2023-08-18T21:10:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wilson.teachey](https://avatars.discourse-cdn.com/v4/letter/w/4491bb/32.png) [@wilson.teachey](https://forum.sierrawireless.com/u/wilson.teachey)\
**Post date:** [August 18, 2023, 9:10pm UTC](https://forum.sierrawireless.com/t/writing-to-modbus-from-fx30/30477/1 "2023-08-18T21:10:36Z")

</div>

Hello everyone,

I am trying to write to an IO board using modbus, and I am having trouble writing to a digital output. The modbus address for these inputs are 00001-00006, and I can read them using Coil as the starting address as shown below.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/sierrawireless/original/2X/2/2776b30a9c01677cf1df8bc85db5d10835289098.png)  
In the Modbus guide ( [Modbus Guides (octave.dev)](https://docs.octave.dev/docs/modbus-guides#setting-up-modbus-communications-via-tcp)) it is clear how to write to a Holding Register (HLD) as shown below.  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/sierrawireless/original/2X/a/ae98927403b5e2b52f2902d8ec5812d6bbef2a7e.png)  
Here, to write to the analog output, I use the HLD as the starting address and the “address” field acts as the offset. I think I could write to the digital output if I knew the three letter code, and I think this is it shown below.  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/sierrawireless/original/2X/a/a26367b21da88d09774461819d27a961f4210b49.png)  
According to this page on the documentation, DO should be the code used as the the “type”. [Modbus Reference (octave.dev)](https://docs.octave.dev/docs/modbus-reference)  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/sierrawireless/original/2X/0/0edc8f37412e8e1e4ff10bb645b288893cc96736.png)

Thanks,  
Wilson Teachey

---

<div class="post-metadata">

**Author:** ![gbetous](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@gbetous](https://forum.sierrawireless.com/u/gbetous)\
**Post date:** [August 21, 2023, 2:25pm UTC](https://forum.sierrawireless.com/t/writing-to-modbus-from-fx30/30477/2 "2023-08-21T14:25:06Z")

</div>

Hi Wilson,

Your question is not very clear, but I confirm you that “DO” is the correct type for Coils (also known as Digital Output).

Let me known of you need any further information.

---

<div class="post-metadata">

**Author:** ![wilson.teachey](https://avatars.discourse-cdn.com/v4/letter/w/4491bb/32.png) [@wilson.teachey](https://forum.sierrawireless.com/u/wilson.teachey)\
**Post date:** [August 21, 2023, 2:46pm UTC](https://forum.sierrawireless.com/t/writing-to-modbus-from-fx30/30477/3 "2023-08-21T14:46:04Z")

</div>

Hello Guillaume,

Sorry the question was not clear. The “DO” code was the primary question that I had. I got it working this morning, but I’m not sure what changed to make it work.

Thanks,  
Wilson Teachey

---

<div class="post-metadata">

**Author:** ![MelanieDKcKnoxUG](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@MelanieDKcKnoxUG](https://forum.sierrawireless.com/u/MelanieDKcKnoxUG)\
**Post date:** [December 30, 2023, 12:38pm UTC](https://forum.sierrawireless.com/t/writing-to-modbus-from-fx30/30477/4 "2023-12-30T12:38:11Z")

</div>

Thanks for the information!
