Error illegal data address

Asked by Nuno Santos

Hello all,

I'm using libmodbus in TCP/IP mode.
I'm trying to set some parameters in a device through preset_single_register function.
When I try to set the device location (1) parmeter in location register 40026 I got the following message: "ERROR Illegal data addess (-2)".

Here is the data:
[00][01][00][00][00][06][01][06][9C][5A][00][01]
Waiting for a message (12 bytes)...
<00><01><00><00><00><03><01><86><02>
ERROR Illegal data address (-2)

The same error is happening in read operations. When I try to read the device status register (40003) through
read_holding_registers function

Here is the data:
[00][06][00][00][00][06][01][03][34][C9][00][01]
Waiting for a message (11 bytes)...
<00><06><00><00><00><03><01><83><02>
ERROR Illegal data address (-2)

Do you see any error in the data sent? Is there any other thing that could be causing this error?

Thanks is advance.

Best regards,
Nuno

Question information

Language:
English Edit question
Status:
Solved
For:
libmodbus Edit question
Assignee:
No assignee Edit question
Solved by:
Marco
Solved:
Last query:
Last reply:
Revision history for this message
Best Marco (emmeci) said :
#1

just a stupid question,
are you sure that the register address is 40026 and not 4x0026 (PLC address)
== 25 (Protocol address)?

On Thu, Jan 13, 2011 at 11:03 PM, Nuno Santos <
<email address hidden>> wrote:

> New question #141368 on libmodbus:
> https://answers.launchpad.net/libmodbus/+question/141368
>
> Hello all,
>
> I'm using libmodbus in TCP/IP mode.
> I'm trying to set some parameters in a device through
> preset_single_register function.
> When I try to set the device location (1) parmeter in location register
> 40026 I got the following message: "ERROR Illegal data addess (-2)".
>
> Here is the data:
> [00][01][00][00][00][06][01][06][9C][5A][00][01]
> Waiting for a message (12 bytes)...
> <00><01><00><00><00><03><01><86><02>
> ERROR Illegal data address (-2)
>
>
> The same error is happening in read operations. When I try to read the
> device status register (40003) through
> read_holding_registers function
>
> Here is the data:
> [00][06][00][00][00][06][01][03][34][C9][00][01]
> Waiting for a message (11 bytes)...
> <00><06><00><00><00><03><01><83><02>
> ERROR Illegal data address (-2)
>
>
> Do you see any error in the data sent? Is there any other thing that could
> be causing this error?
>
>
> Thanks is advance.
>
> Best regards,
> Nuno
>
>
>
>
>
>
>
>
>
> --
> You received this question notification because you are a member of
> Modbus Team, which is an answer contact for libmodbus.
>

Revision history for this message
Nuno Santos (nuno-santos-vigiesolutions) said :
#2

Thank you for your reply.

Not so stupid for who is getting started with modbus, even more when there is almost NO documentation about libmodbus...

Yes the problem was related with the address number that I was passing into the read/write libmodbus functions...

Now it works, thanks ;)

Best regards,
Nuno Santos