# Modbus ExceptionCode 0x01 (IllegalFunction)

**URL:** <https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039>\
**Category:** Ignition\
**Created:** [April 13, 2017, 2:37pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039 "2017-04-13T14:37:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrixmith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/patrixmith/32/75926_2.png) [@patrixmith](https://forum.inductiveautomation.com/u/patrixmith)\
**Post date:** [April 13, 2017, 2:37pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/1 "2017-04-13T14:37:56Z")

</div>

I have a gateway communicating to 3 Modicon Quantum PLCs. The console log is throwing 39,357 errors per hour currently with Logger ReadHoldingRegistersRequest and ReadCoilsRequest, with message Received response with ExceptionCode: 0x01 (IllegalFunction). I’m guessing my PLC type does not support a specific modbus function, but I have only seen that before with writing to bits or coils, not reading them. Is there any device advanced setting I should enable/disable to stop the error?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 13, 2017, 2:40pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/2 "2017-04-13T14:40:24Z")

</div>

There are options to either force reading multiple register/coils or disable reading multiple registers/coils - try playing with those first.

---

<div class="post-metadata">

**Author:** ![patrixmith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/patrixmith/32/75926_2.png) [@patrixmith](https://forum.inductiveautomation.com/u/patrixmith)\
**Post date:** [April 13, 2017, 2:45pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/3 "2017-04-13T14:45:34Z")

</div>

The description on those settings explicitly states: Disable with caution. Which is why I came here first 🙂

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 13, 2017, 2:54pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/4 "2017-04-13T14:54:16Z")

</div>

Yeah, you need to be careful because they can be detrimental to performance depending on how many tags you have and what address ranges they’re in. It’s mostly when disabling the multiple register/coil requests - instead of reading groups of registers/coils at once it forces the driver to read each one individually.

---

<div class="post-metadata">

**Author:** ![patrixmith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/patrixmith/32/75926_2.png) [@patrixmith](https://forum.inductiveautomation.com/u/patrixmith)\
**Post date:** [April 13, 2017, 2:54pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/5 "2017-04-13T14:54:37Z")

</div>

I disabled all read and write multiple register, coil, and input requests and the error messages are still flooding in. ☹

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 13, 2017, 2:55pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/6 "2017-04-13T14:55:39Z")

</div>

Try forcing multiples instead of disabling. The devices might not support the single register version of the request.

---

<div class="post-metadata">

**Author:** ![patrixmith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/patrixmith/32/75926_2.png) [@patrixmith](https://forum.inductiveautomation.com/u/patrixmith)\
**Post date:** [April 13, 2017, 3:02pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/7 "2017-04-13T15:02:35Z")

</div>

Enabled all multiple read/write requests and turned on forcing. Still flooding in… Strange.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 13, 2017, 3:03pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/8 "2017-04-13T15:03:43Z")

</div>

Can you get a Wireshark capture?

---

<div class="post-metadata">

**Author:** ![patrixmith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/patrixmith/32/75926_2.png) [@patrixmith](https://forum.inductiveautomation.com/u/patrixmith)\
**Post date:** [April 13, 2017, 3:04pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/9 "2017-04-13T15:04:44Z")

</div>

Let me work on that. Our segmented network is pretty locked down. Stand by…

---

<div class="post-metadata">

**Author:** ![abishur](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/abishur/32/9096_2.png) [@abishur](https://forum.inductiveautomation.com/u/abishur)\
**Post date:** [April 13, 2017, 3:30pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/10 "2017-04-13T15:30:42Z")

</div>

Are you writing to the zero address of any register range (i.e. 0x0, 1x0, 3x0, or 4x0)? If so make sure you have the advanced option “One-based Addressing” disabled. I use a Modicon M340 and when one-based addressing is enabled all my addresses are 1 address wrong, the 0x01 response code could be because you’re trying to read from/ write to an address outside of the device’s bounds caused by that box being checked.

Here’s a screenshot of my advanced settings when using the M340, I know it’s not a Quantum, but I should imagine since they’re both modicon that their settings should be very similar. The driver type I’m using is Modbus TCP

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/fda7dd46474cefede84bcfee00008bf37d814cdc.png)

---

<div class="post-metadata">

**Author:** ![patrixmith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/patrixmith/32/75926_2.png) [@patrixmith](https://forum.inductiveautomation.com/u/patrixmith)\
**Post date:** [April 13, 2017, 3:46pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/11 "2017-04-13T15:46:51Z")

</div>

I’m not reading or writing to any tags with an address at 0, and my addresses are not off by 1. They match the PLC and previous SCADA system addresses and values. I also do not have any null or bad quality data on any of my tags, and the values brought back match the PLC.

---

<div class="post-metadata">

**Author:** ![abishur](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/abishur/32/9096_2.png) [@abishur](https://forum.inductiveautomation.com/u/abishur)\
**Post date:** [April 13, 2017, 3:59pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/12 "2017-04-13T15:59:46Z")

</div>

It’s never the easy solution is it? While wireshark will reduce the guess work, another possibility would be to disabled the “Span Gaps” option. If you have an address unassigned in the middle of a several other addresses then the Quantum may be returning the 0x01 exception code as that address doesn’t exist. By disabling “Span Gaps”, Ignition should only read contiguous groups. The obvious downside is you are now having to do more read/write transactions to each device.

Edit: though now that I think about it, if this was the problem I believe it would be returning error code 0x02, not 0x01.

---

<div class="post-metadata">

**Author:** ![patrixmith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/patrixmith/32/75926_2.png) [@patrixmith](https://forum.inductiveautomation.com/u/patrixmith)\
**Post date:** [April 13, 2017, 4:13pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/13 "2017-04-13T16:13:11Z")

</div>

Right, not 0x01. I toggled the Span Gaps (actually I have played with all of the device settings now) and did not seem to change anything.

We have hundreds of Modicon PLCs throughout our field coming into numerous Ignition gateways. This is the first time I’ve ever had an issue or seen this error. Very strange.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 13, 2017, 4:14pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/14 "2017-04-13T16:14:30Z")

</div>

Just a sanity check - you’re sure the errors your seeing belong to the devices you’ve been changing settings on?

---

<div class="post-metadata">

**Author:** ![patrixmith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/patrixmith/32/75926_2.png) [@patrixmith](https://forum.inductiveautomation.com/u/patrixmith)\
**Post date:** [April 13, 2017, 4:17pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/15 "2017-04-13T16:17:13Z")

</div>

This gateway only has 3 Modicon device connections, and I have been changing the settings across all 3 devices every time.

Unfortunately the the message doesn’t tell me exactly what device is causing the issue, and there is no stack trace ☹

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 13, 2017, 4:39pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/16 "2017-04-13T16:39:19Z")

</div>

If you turn the logger for ReadHoldingRegistersRequest to TRACE we can see which request(s) these exception responses are to. It’s a bit spammy though, so don’t leave it on longer than necessary.

---

<div class="post-metadata">

**Author:** ![patrixmith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/patrixmith/32/75926_2.png) [@patrixmith](https://forum.inductiveautomation.com/u/patrixmith)\
**Post date:** [April 13, 2017, 5:07pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/17 "2017-04-13T17:07:55Z")

</div>

Nice, the TRACE narrowed it down to 1 particular device. Let me get more info on that device.

---

<div class="post-metadata">

**Author:** ![patrixmith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/patrixmith/32/75926_2.png) [@patrixmith](https://forum.inductiveautomation.com/u/patrixmith)\
**Post date:** [April 13, 2017, 5:39pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/18 "2017-04-13T17:39:43Z")

</div>

Ok… The 2 PLCs with no issues are Modicon Quantums. The 1 PLC that is throwing the error actually happens to be a Modicon 984.

The Quantums are ethernet IP addressable devices; the 984 is not. The 984 at my facility is connected to a modbus-to-modbus-plus converter. The converter is then connected to a modbus-to-ethernet bridge. And Ignition is connecting to the bridge device.

Not sure if this is the reason for the errors, but that is the difference between it and the devices that are not throwing errors.

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/0f0f2d2cdaf72ebbf1f44557bd4ae7a6e44aafa1.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 13, 2017, 5:43pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/19 "2017-04-13T17:43:29Z")

</div>

What are the request bytes that get sent when the exception response comes back? You should be able to see this in the TRACE logging.

---

<div class="post-metadata">

**Author:** ![patrixmith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/patrixmith/32/75926_2.png) [@patrixmith](https://forum.inductiveautomation.com/u/patrixmith)\
**Post date:** [April 13, 2017, 5:47pm UTC](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039/20 "2017-04-13T17:47:11Z")

</div>

![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/91b39d5ddc81901af71164982a3210443cedf52d.png)

[Next page](https://forum.inductiveautomation.com/t/modbus-exceptioncode-0x01-illegalfunction/14039.md?page=2)
