Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-09-02 Thread Christofer Dutz
Hi Ben, 

while I just updated the Modbus documentation I noticed your recent additions 
aren't documented anywhere.
I could probably do it, but I would feel more comfortable if you could do so as 
you actually understand the stuff :-)

Would be super awesome, if you could add the description of your format changes 
& additions in the file:
src/site/asciidoc/users/protocols/modbus.adoc

Chris



Am 16.07.20, 11:48 schrieb "Ben Hutcheson" :

Hi,

*I think we have 6 separate memory areas. Do you have a mapping, That I
could use? I mean which first digit represents which memory area?*
I thought there were only 5 areas?
0x - Coils
1x - Inputs
3x - Input Registers
4x - Holding Registers
6x - Extended Registers

I've seen the IEEE format for 32-bit floats, also another format that gets
used is multiplying the float by 100 or 1000 and then dividing it by the
same on the other end. e.g. 56.67 becomes 5667,

Kind Regards

Ben

On Thu, Jul 16, 2020 at 4:10 AM Niclas Hedhman  wrote:

> For floats, I have only seen IEEE format. But can't rule out other.
>
> On Thu, Jul 16, 2020, 14:57 Christofer Dutz 
> wrote:
>
> > Guess it should be possible for plc4x to interpret INT as two shorts 
long
> > as four... In that case it could probably also handle half precision
> floats
> > (16 bit), full floats and double, if the encoding is somewhat standard
> > (which I assume it's not)
> >
> > Chris
> > 
> > Von: Niclas Hedhman 
> > Gesendet: Donnerstag, 16. Juli 2020 08:33
> > An: dev@plc4x.apache.org 
> > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register
> > addresses have an offset of 1 (Not reading the correct address)
> >
> > To make things worse, there is equipment on the market with both 32-bit
> > numbers as well IEEE floats.
> >
> > And many clients are incapable of doing something meaningful with
> those...
> >
> >
> > And then there is equipment that uses one register to indicate the
> > magnitude of one or more other registers, say 1="divide by 1", 2="divide
> by
> > 10"...
> >
> >
> >
> > Niclas
> >
> > On Thu, Jul 16, 2020, 14:28 Christofer Dutz 
> > wrote:
> >
> > > Hi Ben and Otto,
> > >
> > > First off all, thank you Ben for that very detailed explanation. It
> does
> > > seem as if we should extend the parser to support the different 
numeric
> > > variants. I don't see any problems in supporting both the hex-like one
> as
> > > well as the pure numeric one.
> > >
> > > I think we have 6 separate memory areas. Do you have a mapping, That I
> > > could use? I mean which first digit represents which memory area?
> > >
> > > @otto Modbus doesn't allow floats. Just bits (coils) and shorts
> > > (registers)... Haven't seen a somewhat standard way to encode anything
> > else.
> > >
> > > Chris
> > > 
> > > Von: Otto Fowler 
> > > Gesendet: Donnerstag, 16. Juli 2020 06:41
> > > An: dev@plc4x.apache.org 
> > > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register
> > > addresses have an offset of 1 (Not reading the correct address)
> > >
> > > Don’t forget embedded protocols are possible,
> > > different devices format floats differently
> > > some devices don’t want persistent connections
> > > etc etc
> > >
> > > On July 15, 2020 at 20:48:39, Ben Hutcheson (ben.hut...@gmail.com)
> > wrote:
> > >
> > > Hi,
> > >
> > > Answering some of the questions:-
> > > *I guess what would be interesting, would be what address is going 
over
> > the
> > > wire for "30001" for example.*
> > > The address that gets sent over the wire is the address starting from 0
> > i.e
> > > 31 would be address 0. I didn't know that.
> > >
> > > *Also as a register is always a 16 bit value, the increments by two
> sort
> > of
> > > puzzle me.*
> > > The Modbus registers are numbered 31 thru to 365536 (or whatever
> the
> > > highest is for the device), they are 16 bit registers they don't
> > increment
> > > by 2. If you were mapping 32-bit data types to the registers then of
> > course
> > > you would increment by two but I don't know of any other situation or
> > > device that increments the addresses by 2.
> > >
> > >
> > > *Long time ago, back when the Modbus came to life it was simply a
> > > memory area*
> > > I do vaguely remember working on a device that didn't differentiate
> > between
> > > the memory areas and would just use the address when reading and
> writing,
> > > the leading digit would just specify data type. 01 would be a bit
> in
> > > 41.
> > >

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-17 Thread Christofer Dutz
Hi Ben ... 

I just merged your pull request ... currently doing the full build with all 
tests but so-far it's looking good.
Thanks a lot for this.

Chris


Am 17.07.20, 10:34 schrieb "Christofer Dutz" :

Hi Ben, 

I just reviewed your changes and I like them a lot ... I did find some 
minor things that might deserve tweaking.
But thanks for that :)

Chris

Am 17.07.20, 05:14 schrieb "Ben Hutcheson" :

Hi,

Sure I'll give it a shot,

I have created a pull request to be able to use the (01, 0x1,
11, etc..)  address formats as well as to change the minimum 
address to
1. Corresponding to 01 or the first coil.
Please don't hold back on criticizing it, it is the only way I'll learn.

I'll take a look at adding the extended memory area next, I'm expecting 
it
will take me around a week.

Ben


On Thu, Jul 16, 2020 at 12:25 PM Christofer Dutz 

wrote:

> Aaaahh ... perfect
>
> Thanks Ben and Niclas.
> Guess I'll be doing some Modbus coding pretty soon :-)
>
> But if someone wants to try I'd be more than happy :)
>
> Chris
>
>
>
> Am 16.07.20, 11:48 schrieb "Ben Hutcheson" :
>
> Hi,
>
> *I think we have 6 separate memory areas. Do you have a mapping, 
That I
> could use? I mean which first digit represents which memory area?*
> I thought there were only 5 areas?
> 0x - Coils
> 1x - Inputs
> 3x - Input Registers
> 4x - Holding Registers
> 6x - Extended Registers
>
> I've seen the IEEE format for 32-bit floats, also another format 
that
> gets
> used is multiplying the float by 100 or 1000 and then dividing it 
by
> the
> same on the other end. e.g. 56.67 becomes 5667,
>
> Kind Regards
>
> Ben
>
> On Thu, Jul 16, 2020 at 4:10 AM Niclas Hedhman 

> wrote:
>
> > For floats, I have only seen IEEE format. But can't rule out 
other.
> >
> > On Thu, Jul 16, 2020, 14:57 Christofer Dutz <
> christofer.d...@c-ware.de>
> > wrote:
> >
> > > Guess it should be possible for plc4x to interpret INT as two
> shorts long
> > > as four... In that case it could probably also handle half
> precision
> > floats
> > > (16 bit), full floats and double, if the encoding is somewhat
> standard
> > > (which I assume it's not)
> > >
> > > Chris
> > > 
> > > Von: Niclas Hedhman 
> > > Gesendet: Donnerstag, 16. Juli 2020 08:33
> > > An: dev@plc4x.apache.org 
> > > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding 
register
> > > addresses have an offset of 1 (Not reading the correct 
address)
> > >
> > > To make things worse, there is equipment on the market with 
both
> 32-bit
> > > numbers as well IEEE floats.
> > >
> > > And many clients are incapable of doing something meaningful 
with
> > those...
> > >
> > >
> > > And then there is equipment that uses one register to 
indicate the
> > > magnitude of one or more other registers, say 1="divide by 1",
> 2="divide
> > by
> > > 10"...
> > >
> > >
> > >
> > > Niclas
> > >
> > > On Thu, Jul 16, 2020, 14:28 Christofer Dutz <
> christofer.d...@c-ware.de>
> > > wrote:
> > >
> > > > Hi Ben and Otto,
> > > >
> > > > First off all, thank you Ben for that very detailed 
explanation.
> It
> > does
> > > > seem as if we should extend the parser to support the 
different
> numeric
> > > > variants. I don't see any problems in supporting both the
> hex-like one
> > as
> > > > well as the pure numeric one.
> > > >
> > > > I think we have 6 separate memory areas. Do you have a 
mapping,
> That I
> > > > could use? I mean which first digit represents which memory 
area?
> > > >
> > > > @otto Modbus doesn't allow floats. Just bits (coils) and 
shorts
> > > > (registers)... Haven't seen a somewhat standard way to 
encode
> anything
> > > else.
> > > >
> > > > Chris
> > > > 
> > > > Von: Otto Fowler 
  

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-17 Thread Christofer Dutz
Hi Ben, 

I just reviewed your changes and I like them a lot ... I did find some minor 
things that might deserve tweaking.
But thanks for that :)

Chris

Am 17.07.20, 05:14 schrieb "Ben Hutcheson" :

Hi,

Sure I'll give it a shot,

I have created a pull request to be able to use the (01, 0x1,
11, etc..)  address formats as well as to change the minimum address to
1. Corresponding to 01 or the first coil.
Please don't hold back on criticizing it, it is the only way I'll learn.

I'll take a look at adding the extended memory area next, I'm expecting it
will take me around a week.

Ben


On Thu, Jul 16, 2020 at 12:25 PM Christofer Dutz 
wrote:

> Aaaahh ... perfect
>
> Thanks Ben and Niclas.
> Guess I'll be doing some Modbus coding pretty soon :-)
>
> But if someone wants to try I'd be more than happy :)
>
> Chris
>
>
>
> Am 16.07.20, 11:48 schrieb "Ben Hutcheson" :
>
> Hi,
>
> *I think we have 6 separate memory areas. Do you have a mapping, That 
I
> could use? I mean which first digit represents which memory area?*
> I thought there were only 5 areas?
> 0x - Coils
> 1x - Inputs
> 3x - Input Registers
> 4x - Holding Registers
> 6x - Extended Registers
>
> I've seen the IEEE format for 32-bit floats, also another format that
> gets
> used is multiplying the float by 100 or 1000 and then dividing it by
> the
> same on the other end. e.g. 56.67 becomes 5667,
>
> Kind Regards
>
> Ben
>
> On Thu, Jul 16, 2020 at 4:10 AM Niclas Hedhman 
> wrote:
>
> > For floats, I have only seen IEEE format. But can't rule out other.
> >
> > On Thu, Jul 16, 2020, 14:57 Christofer Dutz <
> christofer.d...@c-ware.de>
> > wrote:
> >
> > > Guess it should be possible for plc4x to interpret INT as two
> shorts long
> > > as four... In that case it could probably also handle half
> precision
> > floats
> > > (16 bit), full floats and double, if the encoding is somewhat
> standard
> > > (which I assume it's not)
> > >
> > > Chris
> > > 
> > > Von: Niclas Hedhman 
> > > Gesendet: Donnerstag, 16. Juli 2020 08:33
> > > An: dev@plc4x.apache.org 
> > > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding 
register
> > > addresses have an offset of 1 (Not reading the correct address)
> > >
> > > To make things worse, there is equipment on the market with both
> 32-bit
> > > numbers as well IEEE floats.
> > >
> > > And many clients are incapable of doing something meaningful with
> > those...
> > >
> > >
> > > And then there is equipment that uses one register to indicate the
> > > magnitude of one or more other registers, say 1="divide by 1",
> 2="divide
> > by
> > > 10"...
> > >
> > >
> > >
> > > Niclas
> > >
> > > On Thu, Jul 16, 2020, 14:28 Christofer Dutz <
> christofer.d...@c-ware.de>
> > > wrote:
> > >
> > > > Hi Ben and Otto,
> > > >
> > > > First off all, thank you Ben for that very detailed explanation.
> It
> > does
> > > > seem as if we should extend the parser to support the different
> numeric
> > > > variants. I don't see any problems in supporting both the
> hex-like one
> > as
> > > > well as the pure numeric one.
> > > >
> > > > I think we have 6 separate memory areas. Do you have a mapping,
> That I
> > > > could use? I mean which first digit represents which memory 
area?
> > > >
> > > > @otto Modbus doesn't allow floats. Just bits (coils) and shorts
> > > > (registers)... Haven't seen a somewhat standard way to encode
> anything
> > > else.
> > > >
> > > > Chris
> > > > 
> > > > Von: Otto Fowler 
> > > > Gesendet: Donnerstag, 16. Juli 2020 06:41
> > > > An: dev@plc4x.apache.org 
> > > > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding
> register
> > > > addresses have an offset of 1 (Not reading the correct address)
> > > >
> > > > Don’t forget embedded protocols are possible,
> > > > different devices format floats differently
> > > > some devices don’t want persistent connections
> > > > etc etc
> > > >
> > > > On July 15, 2020 at 20:48:39, Ben Hutcheson (
> ben.hut...@gmail.com)
> > > wrote:
> > > >
> > > > Hi,
> > > >
> > > > Answering some of the 

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-16 Thread Ben Hutcheson
Hi,

Sure I'll give it a shot,

I have created a pull request to be able to use the (01, 0x1,
11, etc..)  address formats as well as to change the minimum address to
1. Corresponding to 01 or the first coil.
Please don't hold back on criticizing it, it is the only way I'll learn.

I'll take a look at adding the extended memory area next, I'm expecting it
will take me around a week.

Ben


On Thu, Jul 16, 2020 at 12:25 PM Christofer Dutz 
wrote:

> Aaaahh ... perfect
>
> Thanks Ben and Niclas.
> Guess I'll be doing some Modbus coding pretty soon :-)
>
> But if someone wants to try I'd be more than happy :)
>
> Chris
>
>
>
> Am 16.07.20, 11:48 schrieb "Ben Hutcheson" :
>
> Hi,
>
> *I think we have 6 separate memory areas. Do you have a mapping, That I
> could use? I mean which first digit represents which memory area?*
> I thought there were only 5 areas?
> 0x - Coils
> 1x - Inputs
> 3x - Input Registers
> 4x - Holding Registers
> 6x - Extended Registers
>
> I've seen the IEEE format for 32-bit floats, also another format that
> gets
> used is multiplying the float by 100 or 1000 and then dividing it by
> the
> same on the other end. e.g. 56.67 becomes 5667,
>
> Kind Regards
>
> Ben
>
> On Thu, Jul 16, 2020 at 4:10 AM Niclas Hedhman 
> wrote:
>
> > For floats, I have only seen IEEE format. But can't rule out other.
> >
> > On Thu, Jul 16, 2020, 14:57 Christofer Dutz <
> christofer.d...@c-ware.de>
> > wrote:
> >
> > > Guess it should be possible for plc4x to interpret INT as two
> shorts long
> > > as four... In that case it could probably also handle half
> precision
> > floats
> > > (16 bit), full floats and double, if the encoding is somewhat
> standard
> > > (which I assume it's not)
> > >
> > > Chris
> > > 
> > > Von: Niclas Hedhman 
> > > Gesendet: Donnerstag, 16. Juli 2020 08:33
> > > An: dev@plc4x.apache.org 
> > > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register
> > > addresses have an offset of 1 (Not reading the correct address)
> > >
> > > To make things worse, there is equipment on the market with both
> 32-bit
> > > numbers as well IEEE floats.
> > >
> > > And many clients are incapable of doing something meaningful with
> > those...
> > >
> > >
> > > And then there is equipment that uses one register to indicate the
> > > magnitude of one or more other registers, say 1="divide by 1",
> 2="divide
> > by
> > > 10"...
> > >
> > >
> > >
> > > Niclas
> > >
> > > On Thu, Jul 16, 2020, 14:28 Christofer Dutz <
> christofer.d...@c-ware.de>
> > > wrote:
> > >
> > > > Hi Ben and Otto,
> > > >
> > > > First off all, thank you Ben for that very detailed explanation.
> It
> > does
> > > > seem as if we should extend the parser to support the different
> numeric
> > > > variants. I don't see any problems in supporting both the
> hex-like one
> > as
> > > > well as the pure numeric one.
> > > >
> > > > I think we have 6 separate memory areas. Do you have a mapping,
> That I
> > > > could use? I mean which first digit represents which memory area?
> > > >
> > > > @otto Modbus doesn't allow floats. Just bits (coils) and shorts
> > > > (registers)... Haven't seen a somewhat standard way to encode
> anything
> > > else.
> > > >
> > > > Chris
> > > > 
> > > > Von: Otto Fowler 
> > > > Gesendet: Donnerstag, 16. Juli 2020 06:41
> > > > An: dev@plc4x.apache.org 
> > > > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding
> register
> > > > addresses have an offset of 1 (Not reading the correct address)
> > > >
> > > > Don’t forget embedded protocols are possible,
> > > > different devices format floats differently
> > > > some devices don’t want persistent connections
> > > > etc etc
> > > >
> > > > On July 15, 2020 at 20:48:39, Ben Hutcheson (
> ben.hut...@gmail.com)
> > > wrote:
> > > >
> > > > Hi,
> > > >
> > > > Answering some of the questions:-
> > > > *I guess what would be interesting, would be what address is
> going over
> > > the
> > > > wire for "30001" for example.*
> > > > The address that gets sent over the wire is the address starting
> from 0
> > > i.e
> > > > 31 would be address 0. I didn't know that.
> > > >
> > > > *Also as a register is always a 16 bit value, the increments by
> two
> > sort
> > > of
> > > > puzzle me.*
> > > > The Modbus registers are numbered 31 thru to 365536 (or
> whatever
> > the
> > > > highest is for the device), they are 16 bit registers they don't
> > > increment
> > > > by 2. If you were mapping 32-bit data types to the registers
> then of
> > > 

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-16 Thread Christofer Dutz
Aaaahh ... perfect

Thanks Ben and Niclas.
Guess I'll be doing some Modbus coding pretty soon :-)

But if someone wants to try I'd be more than happy :)

Chris



Am 16.07.20, 11:48 schrieb "Ben Hutcheson" :

Hi,

*I think we have 6 separate memory areas. Do you have a mapping, That I
could use? I mean which first digit represents which memory area?*
I thought there were only 5 areas?
0x - Coils
1x - Inputs
3x - Input Registers
4x - Holding Registers
6x - Extended Registers

I've seen the IEEE format for 32-bit floats, also another format that gets
used is multiplying the float by 100 or 1000 and then dividing it by the
same on the other end. e.g. 56.67 becomes 5667,

Kind Regards

Ben

On Thu, Jul 16, 2020 at 4:10 AM Niclas Hedhman  wrote:

> For floats, I have only seen IEEE format. But can't rule out other.
>
> On Thu, Jul 16, 2020, 14:57 Christofer Dutz 
> wrote:
>
> > Guess it should be possible for plc4x to interpret INT as two shorts 
long
> > as four... In that case it could probably also handle half precision
> floats
> > (16 bit), full floats and double, if the encoding is somewhat standard
> > (which I assume it's not)
> >
> > Chris
> > 
> > Von: Niclas Hedhman 
> > Gesendet: Donnerstag, 16. Juli 2020 08:33
> > An: dev@plc4x.apache.org 
> > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register
> > addresses have an offset of 1 (Not reading the correct address)
> >
> > To make things worse, there is equipment on the market with both 32-bit
> > numbers as well IEEE floats.
> >
> > And many clients are incapable of doing something meaningful with
> those...
> >
> >
> > And then there is equipment that uses one register to indicate the
> > magnitude of one or more other registers, say 1="divide by 1", 2="divide
> by
> > 10"...
> >
> >
> >
> > Niclas
> >
> > On Thu, Jul 16, 2020, 14:28 Christofer Dutz 
> > wrote:
> >
> > > Hi Ben and Otto,
> > >
> > > First off all, thank you Ben for that very detailed explanation. It
> does
> > > seem as if we should extend the parser to support the different 
numeric
> > > variants. I don't see any problems in supporting both the hex-like one
> as
> > > well as the pure numeric one.
> > >
> > > I think we have 6 separate memory areas. Do you have a mapping, That I
> > > could use? I mean which first digit represents which memory area?
> > >
> > > @otto Modbus doesn't allow floats. Just bits (coils) and shorts
> > > (registers)... Haven't seen a somewhat standard way to encode anything
> > else.
> > >
> > > Chris
> > > 
> > > Von: Otto Fowler 
> > > Gesendet: Donnerstag, 16. Juli 2020 06:41
> > > An: dev@plc4x.apache.org 
> > > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register
> > > addresses have an offset of 1 (Not reading the correct address)
> > >
> > > Don’t forget embedded protocols are possible,
> > > different devices format floats differently
> > > some devices don’t want persistent connections
> > > etc etc
> > >
> > > On July 15, 2020 at 20:48:39, Ben Hutcheson (ben.hut...@gmail.com)
> > wrote:
> > >
> > > Hi,
> > >
> > > Answering some of the questions:-
> > > *I guess what would be interesting, would be what address is going 
over
> > the
> > > wire for "30001" for example.*
> > > The address that gets sent over the wire is the address starting from 0
> > i.e
> > > 31 would be address 0. I didn't know that.
> > >
> > > *Also as a register is always a 16 bit value, the increments by two
> sort
> > of
> > > puzzle me.*
> > > The Modbus registers are numbered 31 thru to 365536 (or whatever
> the
> > > highest is for the device), they are 16 bit registers they don't
> > increment
> > > by 2. If you were mapping 32-bit data types to the registers then of
> > course
> > > you would increment by two but I don't know of any other situation or
> > > device that increments the addresses by 2.
> > >
> > >
> > > *Long time ago, back when the Modbus came to life it was simply a
> > > memory area*
> > > I do vaguely remember working on a device that didn't differentiate
> > between
> > > the memory areas and would just use the address when reading and
> writing,
> > > the leading digit would just specify data type. 01 would be a bit
> in
> > > 41.
> > >
> > >
> > > *so would you suggest we leave things the way they are or should we
> > change
> > > something?*
> > > I would, it is the most commonly used. I think I have also seen the
> > format
> > > 

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-16 Thread Ben Hutcheson
Hi,

*I think we have 6 separate memory areas. Do you have a mapping, That I
could use? I mean which first digit represents which memory area?*
I thought there were only 5 areas?
0x - Coils
1x - Inputs
3x - Input Registers
4x - Holding Registers
6x - Extended Registers

I've seen the IEEE format for 32-bit floats, also another format that gets
used is multiplying the float by 100 or 1000 and then dividing it by the
same on the other end. e.g. 56.67 becomes 5667,

Kind Regards

Ben

On Thu, Jul 16, 2020 at 4:10 AM Niclas Hedhman  wrote:

> For floats, I have only seen IEEE format. But can't rule out other.
>
> On Thu, Jul 16, 2020, 14:57 Christofer Dutz 
> wrote:
>
> > Guess it should be possible for plc4x to interpret INT as two shorts long
> > as four... In that case it could probably also handle half precision
> floats
> > (16 bit), full floats and double, if the encoding is somewhat standard
> > (which I assume it's not)
> >
> > Chris
> > 
> > Von: Niclas Hedhman 
> > Gesendet: Donnerstag, 16. Juli 2020 08:33
> > An: dev@plc4x.apache.org 
> > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register
> > addresses have an offset of 1 (Not reading the correct address)
> >
> > To make things worse, there is equipment on the market with both 32-bit
> > numbers as well IEEE floats.
> >
> > And many clients are incapable of doing something meaningful with
> those...
> >
> >
> > And then there is equipment that uses one register to indicate the
> > magnitude of one or more other registers, say 1="divide by 1", 2="divide
> by
> > 10"...
> >
> >
> >
> > Niclas
> >
> > On Thu, Jul 16, 2020, 14:28 Christofer Dutz 
> > wrote:
> >
> > > Hi Ben and Otto,
> > >
> > > First off all, thank you Ben for that very detailed explanation. It
> does
> > > seem as if we should extend the parser to support the different numeric
> > > variants. I don't see any problems in supporting both the hex-like one
> as
> > > well as the pure numeric one.
> > >
> > > I think we have 6 separate memory areas. Do you have a mapping, That I
> > > could use? I mean which first digit represents which memory area?
> > >
> > > @otto Modbus doesn't allow floats. Just bits (coils) and shorts
> > > (registers)... Haven't seen a somewhat standard way to encode anything
> > else.
> > >
> > > Chris
> > > 
> > > Von: Otto Fowler 
> > > Gesendet: Donnerstag, 16. Juli 2020 06:41
> > > An: dev@plc4x.apache.org 
> > > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register
> > > addresses have an offset of 1 (Not reading the correct address)
> > >
> > > Don’t forget embedded protocols are possible,
> > > different devices format floats differently
> > > some devices don’t want persistent connections
> > > etc etc
> > >
> > > On July 15, 2020 at 20:48:39, Ben Hutcheson (ben.hut...@gmail.com)
> > wrote:
> > >
> > > Hi,
> > >
> > > Answering some of the questions:-
> > > *I guess what would be interesting, would be what address is going over
> > the
> > > wire for "30001" for example.*
> > > The address that gets sent over the wire is the address starting from 0
> > i.e
> > > 31 would be address 0. I didn't know that.
> > >
> > > *Also as a register is always a 16 bit value, the increments by two
> sort
> > of
> > > puzzle me.*
> > > The Modbus registers are numbered 31 thru to 365536 (or whatever
> the
> > > highest is for the device), they are 16 bit registers they don't
> > increment
> > > by 2. If you were mapping 32-bit data types to the registers then of
> > course
> > > you would increment by two but I don't know of any other situation or
> > > device that increments the addresses by 2.
> > >
> > >
> > > *Long time ago, back when the Modbus came to life it was simply a
> > > memory area*
> > > I do vaguely remember working on a device that didn't differentiate
> > between
> > > the memory areas and would just use the address when reading and
> writing,
> > > the leading digit would just specify data type. 01 would be a bit
> in
> > > 41.
> > >
> > >
> > > *so would you suggest we leave things the way they are or should we
> > change
> > > something?*
> > > I would, it is the most commonly used. I think I have also seen the
> > format
> > > 0x1, 4x1 being used but is less common.
> > >
> > > *I guess we might think about adding different address parser flavors
> in
> > > the future. So we could use the current one per default, but we could
> > add a
> > > Schneider Field parser that helps convert %MW1 to our
> > > holding-register:401 ... or whatever the scematics are.*
> > > You would want to be careful doing this because a lot of the times the
> > > mapping between Modbus Registers and the internal addresses is
> > > configurable. Newer Schnieder PLCs I think have an option to start the
> > > numbering at %MW0 , Rockwell Micrologix PLCs have a configurable
> mapping
> > > table so you can select the data table the Modbus addresses get 

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-16 Thread Niclas Hedhman
For floats, I have only seen IEEE format. But can't rule out other.

On Thu, Jul 16, 2020, 14:57 Christofer Dutz 
wrote:

> Guess it should be possible for plc4x to interpret INT as two shorts long
> as four... In that case it could probably also handle half precision floats
> (16 bit), full floats and double, if the encoding is somewhat standard
> (which I assume it's not)
>
> Chris
> 
> Von: Niclas Hedhman 
> Gesendet: Donnerstag, 16. Juli 2020 08:33
> An: dev@plc4x.apache.org 
> Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register
> addresses have an offset of 1 (Not reading the correct address)
>
> To make things worse, there is equipment on the market with both 32-bit
> numbers as well IEEE floats.
>
> And many clients are incapable of doing something meaningful with those...
>
>
> And then there is equipment that uses one register to indicate the
> magnitude of one or more other registers, say 1="divide by 1", 2="divide by
> 10"...
>
>
>
> Niclas
>
> On Thu, Jul 16, 2020, 14:28 Christofer Dutz 
> wrote:
>
> > Hi Ben and Otto,
> >
> > First off all, thank you Ben for that very detailed explanation. It does
> > seem as if we should extend the parser to support the different numeric
> > variants. I don't see any problems in supporting both the hex-like one as
> > well as the pure numeric one.
> >
> > I think we have 6 separate memory areas. Do you have a mapping, That I
> > could use? I mean which first digit represents which memory area?
> >
> > @otto Modbus doesn't allow floats. Just bits (coils) and shorts
> > (registers)... Haven't seen a somewhat standard way to encode anything
> else.
> >
> > Chris
> > 
> > Von: Otto Fowler 
> > Gesendet: Donnerstag, 16. Juli 2020 06:41
> > An: dev@plc4x.apache.org 
> > Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register
> > addresses have an offset of 1 (Not reading the correct address)
> >
> > Don’t forget embedded protocols are possible,
> > different devices format floats differently
> > some devices don’t want persistent connections
> > etc etc
> >
> > On July 15, 2020 at 20:48:39, Ben Hutcheson (ben.hut...@gmail.com)
> wrote:
> >
> > Hi,
> >
> > Answering some of the questions:-
> > *I guess what would be interesting, would be what address is going over
> the
> > wire for "30001" for example.*
> > The address that gets sent over the wire is the address starting from 0
> i.e
> > 31 would be address 0. I didn't know that.
> >
> > *Also as a register is always a 16 bit value, the increments by two sort
> of
> > puzzle me.*
> > The Modbus registers are numbered 31 thru to 365536 (or whatever the
> > highest is for the device), they are 16 bit registers they don't
> increment
> > by 2. If you were mapping 32-bit data types to the registers then of
> course
> > you would increment by two but I don't know of any other situation or
> > device that increments the addresses by 2.
> >
> >
> > *Long time ago, back when the Modbus came to life it was simply a
> > memory area*
> > I do vaguely remember working on a device that didn't differentiate
> between
> > the memory areas and would just use the address when reading and writing,
> > the leading digit would just specify data type. 01 would be a bit in
> > 41.
> >
> >
> > *so would you suggest we leave things the way they are or should we
> change
> > something?*
> > I would, it is the most commonly used. I think I have also seen the
> format
> > 0x1, 4x1 being used but is less common.
> >
> > *I guess we might think about adding different address parser flavors in
> > the future. So we could use the current one per default, but we could
> add a
> > Schneider Field parser that helps convert %MW1 to our
> > holding-register:401 ... or whatever the scematics are.*
> > You would want to be careful doing this because a lot of the times the
> > mapping between Modbus Registers and the internal addresses is
> > configurable. Newer Schnieder PLCs I think have an option to start the
> > numbering at %MW0 , Rockwell Micrologix PLCs have a configurable mapping
> > table so you can select the data table the Modbus addresses get mapped
> to.
> >
> > Some other things that might not have come up,
> > There is also an extended memory (Leading digit 6) area on some devices.
> > Schneider Quantum controllers I know use this.
> >
> > There are a lot of devices that support Modbus, but the quality of some
> of
> > the implementations can be very poor. I wouldn't be relying on some of
> the
> > non-essential fields (Transaction Ids, Lengths) as they can sometimes not
> > be populated.
> >
> > I also wouldn't assume that every device supports all the function codes.
> > Some devices (Honeywell C200/C300) allow you to select which function
> codes
> > you want to use for each device to try and work around this.
> >
> > For Modbus TCP, some servers won't allow more than a certain number of
> > connections at any 

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-16 Thread Christofer Dutz
Guess it should be possible for plc4x to interpret INT as two shorts long as 
four... In that case it could probably also handle half precision floats (16 
bit), full floats and double, if the encoding is somewhat standard (which I 
assume it's not)

Chris

Von: Niclas Hedhman 
Gesendet: Donnerstag, 16. Juli 2020 08:33
An: dev@plc4x.apache.org 
Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses 
have an offset of 1 (Not reading the correct address)

To make things worse, there is equipment on the market with both 32-bit
numbers as well IEEE floats.

And many clients are incapable of doing something meaningful with those...


And then there is equipment that uses one register to indicate the
magnitude of one or more other registers, say 1="divide by 1", 2="divide by
10"...



Niclas

On Thu, Jul 16, 2020, 14:28 Christofer Dutz 
wrote:

> Hi Ben and Otto,
>
> First off all, thank you Ben for that very detailed explanation. It does
> seem as if we should extend the parser to support the different numeric
> variants. I don't see any problems in supporting both the hex-like one as
> well as the pure numeric one.
>
> I think we have 6 separate memory areas. Do you have a mapping, That I
> could use? I mean which first digit represents which memory area?
>
> @otto Modbus doesn't allow floats. Just bits (coils) and shorts
> (registers)... Haven't seen a somewhat standard way to encode anything else.
>
> Chris
> 
> Von: Otto Fowler 
> Gesendet: Donnerstag, 16. Juli 2020 06:41
> An: dev@plc4x.apache.org 
> Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register
> addresses have an offset of 1 (Not reading the correct address)
>
> Don’t forget embedded protocols are possible,
> different devices format floats differently
> some devices don’t want persistent connections
> etc etc
>
> On July 15, 2020 at 20:48:39, Ben Hutcheson (ben.hut...@gmail.com) wrote:
>
> Hi,
>
> Answering some of the questions:-
> *I guess what would be interesting, would be what address is going over the
> wire for "30001" for example.*
> The address that gets sent over the wire is the address starting from 0 i.e
> 31 would be address 0. I didn't know that.
>
> *Also as a register is always a 16 bit value, the increments by two sort of
> puzzle me.*
> The Modbus registers are numbered 31 thru to 365536 (or whatever the
> highest is for the device), they are 16 bit registers they don't increment
> by 2. If you were mapping 32-bit data types to the registers then of course
> you would increment by two but I don't know of any other situation or
> device that increments the addresses by 2.
>
>
> *Long time ago, back when the Modbus came to life it was simply a
> memory area*
> I do vaguely remember working on a device that didn't differentiate between
> the memory areas and would just use the address when reading and writing,
> the leading digit would just specify data type. 01 would be a bit in
> 41.
>
>
> *so would you suggest we leave things the way they are or should we change
> something?*
> I would, it is the most commonly used. I think I have also seen the format
> 0x1, 4x1 being used but is less common.
>
> *I guess we might think about adding different address parser flavors in
> the future. So we could use the current one per default, but we could add a
> Schneider Field parser that helps convert %MW1 to our
> holding-register:401 ... or whatever the scematics are.*
> You would want to be careful doing this because a lot of the times the
> mapping between Modbus Registers and the internal addresses is
> configurable. Newer Schnieder PLCs I think have an option to start the
> numbering at %MW0 , Rockwell Micrologix PLCs have a configurable mapping
> table so you can select the data table the Modbus addresses get mapped to.
>
> Some other things that might not have come up,
> There is also an extended memory (Leading digit 6) area on some devices.
> Schneider Quantum controllers I know use this.
>
> There are a lot of devices that support Modbus, but the quality of some of
> the implementations can be very poor. I wouldn't be relying on some of the
> non-essential fields (Transaction Ids, Lengths) as they can sometimes not
> be populated.
>
> I also wouldn't assume that every device supports all the function codes.
> Some devices (Honeywell C200/C300) allow you to select which function codes
> you want to use for each device to try and work around this.
>
> For Modbus TCP, some servers won't allow more than a certain number of
> connections at any one time. Sometimes this number is 1. It can be very
> annoying to troubleshoot.
>
> Kind Regards
>
> Ben
>
>
>
>
>
> On Wed, Jul 15, 2020 at 9:53 AM Niclas Hedhman  wrote:
>
> > Let me try again; There is no 3 addresses in the products. It is a
> > notation written with text, by people. the first written digit convey the
> > type. That's it.
> >
> > Long 

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-16 Thread Niclas Hedhman
To make things worse, there is equipment on the market with both 32-bit
numbers as well IEEE floats.

And many clients are incapable of doing something meaningful with those...


And then there is equipment that uses one register to indicate the
magnitude of one or more other registers, say 1="divide by 1", 2="divide by
10"...



Niclas

On Thu, Jul 16, 2020, 14:28 Christofer Dutz 
wrote:

> Hi Ben and Otto,
>
> First off all, thank you Ben for that very detailed explanation. It does
> seem as if we should extend the parser to support the different numeric
> variants. I don't see any problems in supporting both the hex-like one as
> well as the pure numeric one.
>
> I think we have 6 separate memory areas. Do you have a mapping, That I
> could use? I mean which first digit represents which memory area?
>
> @otto Modbus doesn't allow floats. Just bits (coils) and shorts
> (registers)... Haven't seen a somewhat standard way to encode anything else.
>
> Chris
> 
> Von: Otto Fowler 
> Gesendet: Donnerstag, 16. Juli 2020 06:41
> An: dev@plc4x.apache.org 
> Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register
> addresses have an offset of 1 (Not reading the correct address)
>
> Don’t forget embedded protocols are possible,
> different devices format floats differently
> some devices don’t want persistent connections
> etc etc
>
> On July 15, 2020 at 20:48:39, Ben Hutcheson (ben.hut...@gmail.com) wrote:
>
> Hi,
>
> Answering some of the questions:-
> *I guess what would be interesting, would be what address is going over the
> wire for "30001" for example.*
> The address that gets sent over the wire is the address starting from 0 i.e
> 31 would be address 0. I didn't know that.
>
> *Also as a register is always a 16 bit value, the increments by two sort of
> puzzle me.*
> The Modbus registers are numbered 31 thru to 365536 (or whatever the
> highest is for the device), they are 16 bit registers they don't increment
> by 2. If you were mapping 32-bit data types to the registers then of course
> you would increment by two but I don't know of any other situation or
> device that increments the addresses by 2.
>
>
> *Long time ago, back when the Modbus came to life it was simply a
> memory area*
> I do vaguely remember working on a device that didn't differentiate between
> the memory areas and would just use the address when reading and writing,
> the leading digit would just specify data type. 01 would be a bit in
> 41.
>
>
> *so would you suggest we leave things the way they are or should we change
> something?*
> I would, it is the most commonly used. I think I have also seen the format
> 0x1, 4x1 being used but is less common.
>
> *I guess we might think about adding different address parser flavors in
> the future. So we could use the current one per default, but we could add a
> Schneider Field parser that helps convert %MW1 to our
> holding-register:401 ... or whatever the scematics are.*
> You would want to be careful doing this because a lot of the times the
> mapping between Modbus Registers and the internal addresses is
> configurable. Newer Schnieder PLCs I think have an option to start the
> numbering at %MW0 , Rockwell Micrologix PLCs have a configurable mapping
> table so you can select the data table the Modbus addresses get mapped to.
>
> Some other things that might not have come up,
> There is also an extended memory (Leading digit 6) area on some devices.
> Schneider Quantum controllers I know use this.
>
> There are a lot of devices that support Modbus, but the quality of some of
> the implementations can be very poor. I wouldn't be relying on some of the
> non-essential fields (Transaction Ids, Lengths) as they can sometimes not
> be populated.
>
> I also wouldn't assume that every device supports all the function codes.
> Some devices (Honeywell C200/C300) allow you to select which function codes
> you want to use for each device to try and work around this.
>
> For Modbus TCP, some servers won't allow more than a certain number of
> connections at any one time. Sometimes this number is 1. It can be very
> annoying to troubleshoot.
>
> Kind Regards
>
> Ben
>
>
>
>
>
> On Wed, Jul 15, 2020 at 9:53 AM Niclas Hedhman  wrote:
>
> > Let me try again; There is no 3 addresses in the products. It is a
> > notation written with text, by people. the first written digit convey the
> > type. That's it.
> >
> > Long time ago, back when the Modbus came to life it was simply a
> memory
> > area that one could read and possibly write. And then documentation
> > specified what was in each bit/byte/word. And with such approach, it is
> > probably possible to implement Modbus in less than 100 bytes of very
> > expensive (E)PROM back then. Not until later was there address validity
> > checks and what not.
> >
> > FTR; It is completely beyond me how Modbus became as popular as it has,
> and
> > that this happened decades after 

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-16 Thread Christofer Dutz
Hi Ben and Otto,

First off all, thank you Ben for that very detailed explanation. It does seem 
as if we should extend the parser to support the different numeric variants. I 
don't see any problems in supporting both the hex-like one as well as the pure 
numeric one.

I think we have 6 separate memory areas. Do you have a mapping, That I could 
use? I mean which first digit represents which memory area?

@otto Modbus doesn't allow floats. Just bits (coils) and shorts (registers)... 
Haven't seen a somewhat standard way to encode anything else.

Chris

Von: Otto Fowler 
Gesendet: Donnerstag, 16. Juli 2020 06:41
An: dev@plc4x.apache.org 
Betreff: Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses 
have an offset of 1 (Not reading the correct address)

Don’t forget embedded protocols are possible,
different devices format floats differently
some devices don’t want persistent connections
etc etc

On July 15, 2020 at 20:48:39, Ben Hutcheson (ben.hut...@gmail.com) wrote:

Hi,

Answering some of the questions:-
*I guess what would be interesting, would be what address is going over the
wire for "30001" for example.*
The address that gets sent over the wire is the address starting from 0 i.e
31 would be address 0. I didn't know that.

*Also as a register is always a 16 bit value, the increments by two sort of
puzzle me.*
The Modbus registers are numbered 31 thru to 365536 (or whatever the
highest is for the device), they are 16 bit registers they don't increment
by 2. If you were mapping 32-bit data types to the registers then of course
you would increment by two but I don't know of any other situation or
device that increments the addresses by 2.


*Long time ago, back when the Modbus came to life it was simply a
memory area*
I do vaguely remember working on a device that didn't differentiate between
the memory areas and would just use the address when reading and writing,
the leading digit would just specify data type. 01 would be a bit in
41.


*so would you suggest we leave things the way they are or should we change
something?*
I would, it is the most commonly used. I think I have also seen the format
0x1, 4x1 being used but is less common.

*I guess we might think about adding different address parser flavors in
the future. So we could use the current one per default, but we could add a
Schneider Field parser that helps convert %MW1 to our
holding-register:401 ... or whatever the scematics are.*
You would want to be careful doing this because a lot of the times the
mapping between Modbus Registers and the internal addresses is
configurable. Newer Schnieder PLCs I think have an option to start the
numbering at %MW0 , Rockwell Micrologix PLCs have a configurable mapping
table so you can select the data table the Modbus addresses get mapped to.

Some other things that might not have come up,
There is also an extended memory (Leading digit 6) area on some devices.
Schneider Quantum controllers I know use this.

There are a lot of devices that support Modbus, but the quality of some of
the implementations can be very poor. I wouldn't be relying on some of the
non-essential fields (Transaction Ids, Lengths) as they can sometimes not
be populated.

I also wouldn't assume that every device supports all the function codes.
Some devices (Honeywell C200/C300) allow you to select which function codes
you want to use for each device to try and work around this.

For Modbus TCP, some servers won't allow more than a certain number of
connections at any one time. Sometimes this number is 1. It can be very
annoying to troubleshoot.

Kind Regards

Ben





On Wed, Jul 15, 2020 at 9:53 AM Niclas Hedhman  wrote:

> Let me try again; There is no 3 addresses in the products. It is a
> notation written with text, by people. the first written digit convey the
> type. That's it.
>
> Long time ago, back when the Modbus came to life it was simply a
memory
> area that one could read and possibly write. And then documentation
> specified what was in each bit/byte/word. And with such approach, it is
> probably possible to implement Modbus in less than 100 bytes of very
> expensive (E)PROM back then. Not until later was there address validity
> checks and what not.
>
> FTR; It is completely beyond me how Modbus became as popular as it has,
and
> that this happened decades after it was introduced on the market. When I
> was part of a startup and we were developing a serial protocol in
> 1984/1985, we knew of Modbus and thought it was a really poor protocol
> (couldn't even do floating point numbers). I don't like it, but just
about
> every electric thing can be purchased with Modbus option...
>
> Cheers
> Niclas
>
> On Wed, Jul 15, 2020 at 9:39 PM Christofer Dutz  >
> wrote:
>
> > Hi Niclas,
> >
> > Protocol-wise the numbers could be up to 65535 as they use an unsigned
16
> > bit integer as an address.
> >
> > I guess what would be interesting, 

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Otto Fowler
 Don’t forget embedded protocols are possible,
different devices format floats differently
some devices don’t want persistent connections
etc etc

On July 15, 2020 at 20:48:39, Ben Hutcheson (ben.hut...@gmail.com) wrote:

Hi,

Answering some of the questions:-
*I guess what would be interesting, would be what address is going over the
wire for "30001" for example.*
The address that gets sent over the wire is the address starting from 0 i.e
31 would be address 0. I didn't know that.

*Also as a register is always a 16 bit value, the increments by two sort of
puzzle me.*
The Modbus registers are numbered 31 thru to 365536 (or whatever the
highest is for the device), they are 16 bit registers they don't increment
by 2. If you were mapping 32-bit data types to the registers then of course
you would increment by two but I don't know of any other situation or
device that increments the addresses by 2.


*Long time ago, back when the Modbus came to life it was simply a
memory area*
I do vaguely remember working on a device that didn't differentiate between
the memory areas and would just use the address when reading and writing,
the leading digit would just specify data type. 01 would be a bit in
41.


*so would you suggest we leave things the way they are or should we change
something?*
I would, it is the most commonly used. I think I have also seen the format
0x1, 4x1 being used but is less common.

*I guess we might think about adding different address parser flavors in
the future. So we could use the current one per default, but we could add a
Schneider Field parser that helps convert %MW1 to our
holding-register:401 ... or whatever the scematics are.*
You would want to be careful doing this because a lot of the times the
mapping between Modbus Registers and the internal addresses is
configurable. Newer Schnieder PLCs I think have an option to start the
numbering at %MW0 , Rockwell Micrologix PLCs have a configurable mapping
table so you can select the data table the Modbus addresses get mapped to.

Some other things that might not have come up,
There is also an extended memory (Leading digit 6) area on some devices.
Schneider Quantum controllers I know use this.

There are a lot of devices that support Modbus, but the quality of some of
the implementations can be very poor. I wouldn't be relying on some of the
non-essential fields (Transaction Ids, Lengths) as they can sometimes not
be populated.

I also wouldn't assume that every device supports all the function codes.
Some devices (Honeywell C200/C300) allow you to select which function codes
you want to use for each device to try and work around this.

For Modbus TCP, some servers won't allow more than a certain number of
connections at any one time. Sometimes this number is 1. It can be very
annoying to troubleshoot.

Kind Regards

Ben





On Wed, Jul 15, 2020 at 9:53 AM Niclas Hedhman  wrote:

> Let me try again; There is no 3 addresses in the products. It is a
> notation written with text, by people. the first written digit convey the
> type. That's it.
>
> Long time ago, back when the Modbus came to life it was simply a
memory
> area that one could read and possibly write. And then documentation
> specified what was in each bit/byte/word. And with such approach, it is
> probably possible to implement Modbus in less than 100 bytes of very
> expensive (E)PROM back then. Not until later was there address validity
> checks and what not.
>
> FTR; It is completely beyond me how Modbus became as popular as it has,
and
> that this happened decades after it was introduced on the market. When I
> was part of a startup and we were developing a serial protocol in
> 1984/1985, we knew of Modbus and thought it was a really poor protocol
> (couldn't even do floating point numbers). I don't like it, but just
about
> every electric thing can be purchased with Modbus option...
>
> Cheers
> Niclas
>
> On Wed, Jul 15, 2020 at 9:39 PM Christofer Dutz  >
> wrote:
>
> > Hi Niclas,
> >
> > Protocol-wise the numbers could be up to 65535 as they use an unsigned
16
> > bit integer as an address.
> >
> > I guess what would be interesting, would be what address is going over
> the
> > wire for "30001" for example.
> > Also as a register is always a 16 bit value, the increments by two sort
> of
> > puzzle me.
> >
> > I think Modbus is an extremely simple protocol but we need to get a
> > feeling for it's usages.
> >
> > It does seem as if the industry tends to wrap some aspects in software
> > bubble-wrap ... we gotta find out what's below.
> >
> > Chris
> >
> >
> > Am 15.07.20, 15:23 schrieb "Niclas Hedhman" :
> >
> > It is a common format in equipment documentation. I am currently
> > working
> > with an electric meter. See screenshot from its manual;
> >
> >
>
https://ipfs.subutai.io/ipfs/QmPsra6ExrkSX9GCYWgHa6CTfJbBnddLVXJ3NmJjmAYrAk
> >
> > At protocol level, there are no such "high numbers", just that the
> > industry
> > got used 

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Ben Hutcheson
Hi,

Answering some of the questions:-
*I guess what would be interesting, would be what address is going over the
wire for "30001" for example.*
The address that gets sent over the wire is the address starting from 0 i.e
31 would be address 0. I didn't know that.

*Also as a register is always a 16 bit value, the increments by two sort of
puzzle me.*
The Modbus registers are numbered 31 thru to 365536 (or whatever the
highest is for the device), they are 16 bit registers they don't increment
by 2. If you were mapping 32-bit data types to the registers then of course
you would increment by two but I don't know of any other situation or
device that increments the addresses by 2.


*Long time ago, back when the Modbus came to life it was simply a
memory area*
I do vaguely remember working on a device that didn't differentiate between
the memory areas and would just use the address when reading and writing,
the leading digit would just specify data type. 01 would be a bit in
41.


*so would you suggest we leave things the way they are or should we change
something?*
I would, it is the most commonly used. I think I have also seen the format
0x1, 4x1 being used but is less common.

*I guess we might think about adding different address parser flavors in
the future. So we could use the current one per default, but we could add a
Schneider Field parser that helps convert %MW1 to our
holding-register:401 ... or whatever the scematics are.*
You would want to be careful doing this because a lot of the times the
mapping between Modbus Registers and the internal addresses is
configurable. Newer Schnieder PLCs I think have an option to start the
numbering at %MW0 , Rockwell Micrologix PLCs have a configurable mapping
table so you can select the data table the Modbus addresses get mapped to.

Some other things that might not have come up,
There is also an extended memory (Leading digit 6) area on some devices.
Schneider Quantum controllers I know use this.

There are a lot of devices that support Modbus, but the quality of some of
the implementations can be very poor. I wouldn't be relying on some of the
non-essential fields (Transaction Ids, Lengths) as they can sometimes not
be populated.

I also wouldn't assume that every device supports all the function codes.
Some devices (Honeywell C200/C300) allow you to select which function codes
you want to use for each device to try and work around this.

For Modbus TCP, some servers won't allow more than a certain number of
connections at any one time. Sometimes this number is 1. It can be very
annoying to troubleshoot.

Kind Regards

Ben





On Wed, Jul 15, 2020 at 9:53 AM Niclas Hedhman  wrote:

> Let me try again; There is no 3 addresses in the products. It is a
> notation written with text, by people. the first written digit convey the
> type. That's it.
>
> Long time ago, back when the Modbus came to life it was simply a memory
> area that one could read and possibly write. And then documentation
> specified what was in each bit/byte/word. And with such approach, it is
> probably possible to implement Modbus in less than 100 bytes of very
> expensive (E)PROM back then. Not until later was there address validity
> checks and what not.
>
> FTR; It is completely beyond me how Modbus became as popular as it has, and
> that this happened decades after it was introduced on the market. When I
> was part of a startup and we were developing a serial protocol in
> 1984/1985, we knew of Modbus and thought it was a really poor protocol
> (couldn't even do floating point numbers). I don't like it, but just about
> every electric thing can be purchased with Modbus option...
>
> Cheers
> Niclas
>
> On Wed, Jul 15, 2020 at 9:39 PM Christofer Dutz  >
> wrote:
>
> > Hi Niclas,
> >
> > Protocol-wise the numbers could be up to 65535 as they use an unsigned 16
> > bit integer as an address.
> >
> > I guess what would be interesting, would be what address is going over
> the
> > wire for "30001" for example.
> > Also as a register is always a 16 bit value, the increments by two sort
> of
> > puzzle me.
> >
> > I think Modbus is an extremely simple protocol but we need to get a
> > feeling for it's usages.
> >
> > It does seem as if the industry tends to wrap some aspects in software
> > bubble-wrap ... we gotta find out what's below.
> >
> > Chris
> >
> >
> > Am 15.07.20, 15:23 schrieb "Niclas Hedhman" :
> >
> > It is a common format in equipment documentation. I am currently
> > working
> > with an electric meter. See screenshot from its manual;
> >
> >
> https://ipfs.subutai.io/ipfs/QmPsra6ExrkSX9GCYWgHa6CTfJbBnddLVXJ3NmJjmAYrAk
> >
> > At protocol level, there are no such "high numbers", just that the
> > industry
> > got used to write "4" instead "holding register". It is a "people
> > thing",
> > not a technical one.
> >
> > HTH
> > Niclas
> >
> > On Wed, Jul 15, 2020 at 6:11 PM Christofer Dutz <
> > 

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Niclas Hedhman
Let me try again; There is no 3 addresses in the products. It is a
notation written with text, by people. the first written digit convey the
type. That's it.

Long time ago, back when the Modbus came to life it was simply a memory
area that one could read and possibly write. And then documentation
specified what was in each bit/byte/word. And with such approach, it is
probably possible to implement Modbus in less than 100 bytes of very
expensive (E)PROM back then. Not until later was there address validity
checks and what not.

FTR; It is completely beyond me how Modbus became as popular as it has, and
that this happened decades after it was introduced on the market. When I
was part of a startup and we were developing a serial protocol in
1984/1985, we knew of Modbus and thought it was a really poor protocol
(couldn't even do floating point numbers). I don't like it, but just about
every electric thing can be purchased with Modbus option...

Cheers
Niclas

On Wed, Jul 15, 2020 at 9:39 PM Christofer Dutz 
wrote:

> Hi Niclas,
>
> Protocol-wise the numbers could be up to 65535 as they use an unsigned 16
> bit integer as an address.
>
> I guess what would be interesting, would be what address is going over the
> wire for "30001" for example.
> Also as a register is always a 16 bit value, the increments by two sort of
> puzzle me.
>
> I think Modbus is an extremely simple protocol but we need to get a
> feeling for it's usages.
>
> It does seem as if the industry tends to wrap some aspects in software
> bubble-wrap ... we gotta find out what's below.
>
> Chris
>
>
> Am 15.07.20, 15:23 schrieb "Niclas Hedhman" :
>
> It is a common format in equipment documentation. I am currently
> working
> with an electric meter. See screenshot from its manual;
>
> https://ipfs.subutai.io/ipfs/QmPsra6ExrkSX9GCYWgHa6CTfJbBnddLVXJ3NmJjmAYrAk
>
> At protocol level, there are no such "high numbers", just that the
> industry
> got used to write "4" instead "holding register". It is a "people
> thing",
> not a technical one.
>
> HTH
> Niclas
>
> On Wed, Jul 15, 2020 at 6:11 PM Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > Hmmm ...
> >
> > Regarding: 10012 being a coil and 4 a register.
> >
> > Well the coils and registers are completely different things ...
> They are
> > accessed via completely different requests.
> > That might be some sort of convenience convention, but I wouldn't
> call
> > that a standard (I've actually never seen it before)
> > Would you then just subtract 4 from every register or would you
> just
> > configure registers starting with numbers 4?
> >
> > What do the others think? The address format does reference
> registers ...
> > should we be doing the translation?
> >
> > I guess that the general use-case would be that someone has a look
> at his
> > Modbus config and says that he wants "Register X"
> > and not "The Register Y references" (which seems to be one less) ...
> I
> > might even swing my vote in favor to using register numbers instead
> of
> > addresses.
> >
> > But then I ask myself: How can I address register 0 in ModbusPal ...
> that
> > would require an address that's impossible to send.
> >
> > Chris
> >
> >
> > Am 15.07.20, 11:51 schrieb "Niclas Hedhman" :
> >
> > Personall, I prefer that Register Numbers are used in APIs and
> that the
> > address is only seen if you analyze the over-the-wire format,
> but maybe
> > that is just me. A big reason for this is that any interface
> presented
> > to
> > an operator would need to use RegNumbers, as most (possibly all)
> > documentation of equipment has RegNumbers and some are lacking
> the
> > addresses. It is also common that the register type is part of
> the
> > Register
> > Number, such as 10012, where the first 1 indicates "coil"
> (IIRC). and
> > holding registers are in 4. Ideally(!), this is also handled
> by the
> > register/address parser.
> >
> > Niclas
> >
> > On Wed, Jul 15, 2020 at 5:43 PM Christofer Dutz <
> > christofer.d...@c-ware.de>
> > wrote:
> >
> > > Hmm .. so are we doing it correctly?
> > >
> > > I mean Wireshark isn't the ideal reference here as I have
> several
> > valid
> > > packets in the KNX space, where WireShark just says "corrupt
> > package".
> > >
> > > So if you enter an "holding-register:42" address it tries to
> read the
> > > register number 43 in ModbusPAL.
> > >
> > > I guess as we are reading an "address" we are correct and
> probably as
> > > ModusPAL says register number, that might be correct too?
> > >
> > > Chris
> > >
> > >
> > > Am 15.07.20, 10:54 schrieb "Niclas 

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Christofer Dutz
Hi Niclas,

Protocol-wise the numbers could be up to 65535 as they use an unsigned 16 bit 
integer as an address.

I guess what would be interesting, would be what address is going over the wire 
for "30001" for example.
Also as a register is always a 16 bit value, the increments by two sort of 
puzzle me.

I think Modbus is an extremely simple protocol but we need to get a feeling for 
it's usages.

It does seem as if the industry tends to wrap some aspects in software 
bubble-wrap ... we gotta find out what's below.

Chris


Am 15.07.20, 15:23 schrieb "Niclas Hedhman" :

It is a common format in equipment documentation. I am currently working
with an electric meter. See screenshot from its manual;
https://ipfs.subutai.io/ipfs/QmPsra6ExrkSX9GCYWgHa6CTfJbBnddLVXJ3NmJjmAYrAk

At protocol level, there are no such "high numbers", just that the industry
got used to write "4" instead "holding register". It is a "people thing",
not a technical one.

HTH
Niclas

On Wed, Jul 15, 2020 at 6:11 PM Christofer Dutz 
wrote:

> Hmmm ...
>
> Regarding: 10012 being a coil and 4 a register.
>
> Well the coils and registers are completely different things ... They are
> accessed via completely different requests.
> That might be some sort of convenience convention, but I wouldn't call
> that a standard (I've actually never seen it before)
> Would you then just subtract 4 from every register or would you just
> configure registers starting with numbers 4?
>
> What do the others think? The address format does reference registers ...
> should we be doing the translation?
>
> I guess that the general use-case would be that someone has a look at his
> Modbus config and says that he wants "Register X"
> and not "The Register Y references" (which seems to be one less) ... I
> might even swing my vote in favor to using register numbers instead of
> addresses.
>
> But then I ask myself: How can I address register 0 in ModbusPal ... that
> would require an address that's impossible to send.
>
> Chris
>
>
> Am 15.07.20, 11:51 schrieb "Niclas Hedhman" :
>
> Personall, I prefer that Register Numbers are used in APIs and that 
the
> address is only seen if you analyze the over-the-wire format, but 
maybe
> that is just me. A big reason for this is that any interface presented
> to
> an operator would need to use RegNumbers, as most (possibly all)
> documentation of equipment has RegNumbers and some are lacking the
> addresses. It is also common that the register type is part of the
> Register
> Number, such as 10012, where the first 1 indicates "coil" (IIRC). and
> holding registers are in 4. Ideally(!), this is also handled by 
the
> register/address parser.
>
> Niclas
>
> On Wed, Jul 15, 2020 at 5:43 PM Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > Hmm .. so are we doing it correctly?
> >
> > I mean Wireshark isn't the ideal reference here as I have several
> valid
> > packets in the KNX space, where WireShark just says "corrupt
> package".
> >
> > So if you enter an "holding-register:42" address it tries to read 
the
> > register number 43 in ModbusPAL.
> >
> > I guess as we are reading an "address" we are correct and probably 
as
> > ModusPAL says register number, that might be correct too?
> >
> > Chris
> >
> >
> > Am 15.07.20, 10:54 schrieb "Niclas Hedhman" :
> >
> > The issue with 1-offset is that the "Register Number" found in
> > documentation is at an "Address" one position less. So Reg 41 
has
> > Address
> > 40. Som libraries expect Register Numbers and some expect
> Register
> > Address.
> > And every so often, one mixes that up.
> >
> > On Wed, Jul 15, 2020 at 2:53 PM Christofer Dutz <
> > christofer.d...@c-ware.de>
> > wrote:
> >
> > > 
> > >
> > > While looking for more Infos I found out I once wrote a
> tutorial
> > page for
> > > PLC4X __
> > >
> > > https://plc4x.apache.org/users/plc4j/virtual-modbus.html
> > >
> > > I so totally hate searching the web and getting my answers
> answered
> > by
> > > myself.
> > >
> > > Chris
> > >
> > > Am 15.07.20, 08:31 schrieb "Christofer Dutz" <
> > christofer.d...@c-ware.de>:
> > >
> > > Hi Niclas,
> > >
> > > when preparing a workshop for the Building IoT we were
> looking
> > 

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Niclas Hedhman
It is a common format in equipment documentation. I am currently working
with an electric meter. See screenshot from its manual;
https://ipfs.subutai.io/ipfs/QmPsra6ExrkSX9GCYWgHa6CTfJbBnddLVXJ3NmJjmAYrAk

At protocol level, there are no such "high numbers", just that the industry
got used to write "4" instead "holding register". It is a "people thing",
not a technical one.

HTH
Niclas

On Wed, Jul 15, 2020 at 6:11 PM Christofer Dutz 
wrote:

> Hmmm ...
>
> Regarding: 10012 being a coil and 4 a register.
>
> Well the coils and registers are completely different things ... They are
> accessed via completely different requests.
> That might be some sort of convenience convention, but I wouldn't call
> that a standard (I've actually never seen it before)
> Would you then just subtract 4 from every register or would you just
> configure registers starting with numbers 4?
>
> What do the others think? The address format does reference registers ...
> should we be doing the translation?
>
> I guess that the general use-case would be that someone has a look at his
> Modbus config and says that he wants "Register X"
> and not "The Register Y references" (which seems to be one less) ... I
> might even swing my vote in favor to using register numbers instead of
> addresses.
>
> But then I ask myself: How can I address register 0 in ModbusPal ... that
> would require an address that's impossible to send.
>
> Chris
>
>
> Am 15.07.20, 11:51 schrieb "Niclas Hedhman" :
>
> Personall, I prefer that Register Numbers are used in APIs and that the
> address is only seen if you analyze the over-the-wire format, but maybe
> that is just me. A big reason for this is that any interface presented
> to
> an operator would need to use RegNumbers, as most (possibly all)
> documentation of equipment has RegNumbers and some are lacking the
> addresses. It is also common that the register type is part of the
> Register
> Number, such as 10012, where the first 1 indicates "coil" (IIRC). and
> holding registers are in 4. Ideally(!), this is also handled by the
> register/address parser.
>
> Niclas
>
> On Wed, Jul 15, 2020 at 5:43 PM Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > Hmm .. so are we doing it correctly?
> >
> > I mean Wireshark isn't the ideal reference here as I have several
> valid
> > packets in the KNX space, where WireShark just says "corrupt
> package".
> >
> > So if you enter an "holding-register:42" address it tries to read the
> > register number 43 in ModbusPAL.
> >
> > I guess as we are reading an "address" we are correct and probably as
> > ModusPAL says register number, that might be correct too?
> >
> > Chris
> >
> >
> > Am 15.07.20, 10:54 schrieb "Niclas Hedhman" :
> >
> > The issue with 1-offset is that the "Register Number" found in
> > documentation is at an "Address" one position less. So Reg 41 has
> > Address
> > 40. Som libraries expect Register Numbers and some expect
> Register
> > Address.
> > And every so often, one mixes that up.
> >
> > On Wed, Jul 15, 2020 at 2:53 PM Christofer Dutz <
> > christofer.d...@c-ware.de>
> > wrote:
> >
> > > 
> > >
> > > While looking for more Infos I found out I once wrote a
> tutorial
> > page for
> > > PLC4X __
> > >
> > > https://plc4x.apache.org/users/plc4j/virtual-modbus.html
> > >
> > > I so totally hate searching the web and getting my answers
> answered
> > by
> > > myself.
> > >
> > > Chris
> > >
> > > Am 15.07.20, 08:31 schrieb "Christofer Dutz" <
> > christofer.d...@c-ware.de>:
> > >
> > > Hi Niclas,
> > >
> > > when preparing a workshop for the Building IoT we were
> looking
> > for
> > > something where you could simulate a Modbus Slave.
> > > Most of these were Windows only solutions, so ModbusPAL
> was one
> > of the
> > > very few solutions that were pure-java.
> > >
> > > Don't quite understand what the thing with the offset is
> however
> > ...
> > > should be easy to fix ... I mean if I say address 42 in PLC4X,
> > Wireshark
> > > says 42, but in Modbus Pal I think it has to be 43 ... don't
> quite
> > get it.
> > >
> > > Chris
> > >
> > >
> > >
> > > Am 15.07.20, 03:54 schrieb "Niclas Hedhman" <
> nic...@hedhman.org
> > >:
> > >
> > > What is ModbusPAL?
> > >
> > > The 1-offset in Modbus has caused a lot of confusion
> over the
> > > years.
> > >
> > > On Tue, Jul 14, 2020 at 11:03 PM Christofer Dutz <
> > > christofer.d...@c-ware.de>
> > > 

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Christofer Dutz
Hi Ben,

please excuse this potentially stupid question ... so would you suggest we leave
things the way they are or should we change something?

Right now we're using the modbus address syntax, ignoring any potential mapping 
strategy.

I guess we might think about adding different address parser flavors in the 
future.
So we could use the current one per default, but we could add a Schneider Field 
parser
that helps convert %MW1 to our holding-register:401 ... or whatever the 
scematics are.

Chris


Am 15.07.20, 12:33 schrieb "Ben Hutcheson" :

Hi,

I've new but been listening to this conversation, this issue always pops up
when setting up Modbus communications.

I would vote for the API using the modbus register 41, 01, etc..

The translation between modbus registers and the address in the
PLC/simulator is handled within the device. if ModbusPal maps modbus
registers to the address below it so be it (Although this should be
consistent when reading/writing Modbus registers).

Schnieder maps Modbus registers to internal registers 41 -> %MW1 (I
think schneider M340 and M580 PLCs have an option to map Modbus registers
to PLC addresses starting at 0), Rockwell maps them to data files 41 -
> N1:1.

Kind Regards,

Ben

On Wed, Jul 15, 2020 at 6:11 AM Christofer Dutz 
wrote:

> Hmmm ...
>
> Regarding: 10012 being a coil and 4 a register.
>
> Well the coils and registers are completely different things ... They are
> accessed via completely different requests.
> That might be some sort of convenience convention, but I wouldn't call
> that a standard (I've actually never seen it before)
> Would you then just subtract 4 from every register or would you just
> configure registers starting with numbers 4?
>
> What do the others think? The address format does reference registers ...
> should we be doing the translation?
>
> I guess that the general use-case would be that someone has a look at his
> Modbus config and says that he wants "Register X"
> and not "The Register Y references" (which seems to be one less) ... I
> might even swing my vote in favor to using register numbers instead of
> addresses.
>
> But then I ask myself: How can I address register 0 in ModbusPal ... that
> would require an address that's impossible to send.
>
> Chris
>
>
> Am 15.07.20, 11:51 schrieb "Niclas Hedhman" :
>
> Personall, I prefer that Register Numbers are used in APIs and that 
the
> address is only seen if you analyze the over-the-wire format, but 
maybe
> that is just me. A big reason for this is that any interface presented
> to
> an operator would need to use RegNumbers, as most (possibly all)
> documentation of equipment has RegNumbers and some are lacking the
> addresses. It is also common that the register type is part of the
> Register
> Number, such as 10012, where the first 1 indicates "coil" (IIRC). and
> holding registers are in 4. Ideally(!), this is also handled by 
the
> register/address parser.
>
> Niclas
>
> On Wed, Jul 15, 2020 at 5:43 PM Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > Hmm .. so are we doing it correctly?
> >
> > I mean Wireshark isn't the ideal reference here as I have several
> valid
> > packets in the KNX space, where WireShark just says "corrupt
> package".
> >
> > So if you enter an "holding-register:42" address it tries to read 
the
> > register number 43 in ModbusPAL.
> >
> > I guess as we are reading an "address" we are correct and probably 
as
> > ModusPAL says register number, that might be correct too?
> >
> > Chris
> >
> >
> > Am 15.07.20, 10:54 schrieb "Niclas Hedhman" :
> >
> > The issue with 1-offset is that the "Register Number" found in
> > documentation is at an "Address" one position less. So Reg 41 
has
> > Address
> > 40. Som libraries expect Register Numbers and some expect
> Register
> > Address.
> > And every so often, one mixes that up.
> >
> > On Wed, Jul 15, 2020 at 2:53 PM Christofer Dutz <
> > christofer.d...@c-ware.de>
> > wrote:
> >
> > > 
> > >
> > > While looking for more Infos I found out I once wrote a
> tutorial
> > page for
> > > PLC4X __
> > >
> > > https://plc4x.apache.org/users/plc4j/virtual-modbus.html
> > >
> > > I so totally hate searching the web and getting my answers
> answered
> > by
> > > myself.
> > >
> > 

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Ben Hutcheson
Hi,

I've new but been listening to this conversation, this issue always pops up
when setting up Modbus communications.

I would vote for the API using the modbus register 41, 01, etc..

The translation between modbus registers and the address in the
PLC/simulator is handled within the device. if ModbusPal maps modbus
registers to the address below it so be it (Although this should be
consistent when reading/writing Modbus registers).

Schnieder maps Modbus registers to internal registers 41 -> %MW1 (I
think schneider M340 and M580 PLCs have an option to map Modbus registers
to PLC addresses starting at 0), Rockwell maps them to data files 41 -
> N1:1.

Kind Regards,

Ben

On Wed, Jul 15, 2020 at 6:11 AM Christofer Dutz 
wrote:

> Hmmm ...
>
> Regarding: 10012 being a coil and 4 a register.
>
> Well the coils and registers are completely different things ... They are
> accessed via completely different requests.
> That might be some sort of convenience convention, but I wouldn't call
> that a standard (I've actually never seen it before)
> Would you then just subtract 4 from every register or would you just
> configure registers starting with numbers 4?
>
> What do the others think? The address format does reference registers ...
> should we be doing the translation?
>
> I guess that the general use-case would be that someone has a look at his
> Modbus config and says that he wants "Register X"
> and not "The Register Y references" (which seems to be one less) ... I
> might even swing my vote in favor to using register numbers instead of
> addresses.
>
> But then I ask myself: How can I address register 0 in ModbusPal ... that
> would require an address that's impossible to send.
>
> Chris
>
>
> Am 15.07.20, 11:51 schrieb "Niclas Hedhman" :
>
> Personall, I prefer that Register Numbers are used in APIs and that the
> address is only seen if you analyze the over-the-wire format, but maybe
> that is just me. A big reason for this is that any interface presented
> to
> an operator would need to use RegNumbers, as most (possibly all)
> documentation of equipment has RegNumbers and some are lacking the
> addresses. It is also common that the register type is part of the
> Register
> Number, such as 10012, where the first 1 indicates "coil" (IIRC). and
> holding registers are in 4. Ideally(!), this is also handled by the
> register/address parser.
>
> Niclas
>
> On Wed, Jul 15, 2020 at 5:43 PM Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > Hmm .. so are we doing it correctly?
> >
> > I mean Wireshark isn't the ideal reference here as I have several
> valid
> > packets in the KNX space, where WireShark just says "corrupt
> package".
> >
> > So if you enter an "holding-register:42" address it tries to read the
> > register number 43 in ModbusPAL.
> >
> > I guess as we are reading an "address" we are correct and probably as
> > ModusPAL says register number, that might be correct too?
> >
> > Chris
> >
> >
> > Am 15.07.20, 10:54 schrieb "Niclas Hedhman" :
> >
> > The issue with 1-offset is that the "Register Number" found in
> > documentation is at an "Address" one position less. So Reg 41 has
> > Address
> > 40. Som libraries expect Register Numbers and some expect
> Register
> > Address.
> > And every so often, one mixes that up.
> >
> > On Wed, Jul 15, 2020 at 2:53 PM Christofer Dutz <
> > christofer.d...@c-ware.de>
> > wrote:
> >
> > > 
> > >
> > > While looking for more Infos I found out I once wrote a
> tutorial
> > page for
> > > PLC4X __
> > >
> > > https://plc4x.apache.org/users/plc4j/virtual-modbus.html
> > >
> > > I so totally hate searching the web and getting my answers
> answered
> > by
> > > myself.
> > >
> > > Chris
> > >
> > > Am 15.07.20, 08:31 schrieb "Christofer Dutz" <
> > christofer.d...@c-ware.de>:
> > >
> > > Hi Niclas,
> > >
> > > when preparing a workshop for the Building IoT we were
> looking
> > for
> > > something where you could simulate a Modbus Slave.
> > > Most of these were Windows only solutions, so ModbusPAL
> was one
> > of the
> > > very few solutions that were pure-java.
> > >
> > > Don't quite understand what the thing with the offset is
> however
> > ...
> > > should be easy to fix ... I mean if I say address 42 in PLC4X,
> > Wireshark
> > > says 42, but in Modbus Pal I think it has to be 43 ... don't
> quite
> > get it.
> > >
> > > Chris
> > >
> > >
> > >
> > > Am 15.07.20, 03:54 schrieb "Niclas Hedhman" <
> nic...@hedhman.org
> > >:
> > >
>   

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Christofer Dutz
Hmmm ... 

Regarding: 10012 being a coil and 4 a register.

Well the coils and registers are completely different things ... They are 
accessed via completely different requests. 
That might be some sort of convenience convention, but I wouldn't call that a 
standard (I've actually never seen it before)
Would you then just subtract 4 from every register or would you just 
configure registers starting with numbers 4?

What do the others think? The address format does reference registers ... 
should we be doing the translation?

I guess that the general use-case would be that someone has a look at his 
Modbus config and says that he wants "Register X"
and not "The Register Y references" (which seems to be one less) ... I might 
even swing my vote in favor to using register numbers instead of addresses.

But then I ask myself: How can I address register 0 in ModbusPal ... that would 
require an address that's impossible to send.

Chris


Am 15.07.20, 11:51 schrieb "Niclas Hedhman" :

Personall, I prefer that Register Numbers are used in APIs and that the
address is only seen if you analyze the over-the-wire format, but maybe
that is just me. A big reason for this is that any interface presented to
an operator would need to use RegNumbers, as most (possibly all)
documentation of equipment has RegNumbers and some are lacking the
addresses. It is also common that the register type is part of the Register
Number, such as 10012, where the first 1 indicates "coil" (IIRC). and
holding registers are in 4. Ideally(!), this is also handled by the
register/address parser.

Niclas

On Wed, Jul 15, 2020 at 5:43 PM Christofer Dutz 
wrote:

> Hmm .. so are we doing it correctly?
>
> I mean Wireshark isn't the ideal reference here as I have several valid
> packets in the KNX space, where WireShark just says "corrupt package".
>
> So if you enter an "holding-register:42" address it tries to read the
> register number 43 in ModbusPAL.
>
> I guess as we are reading an "address" we are correct and probably as
> ModusPAL says register number, that might be correct too?
>
> Chris
>
>
> Am 15.07.20, 10:54 schrieb "Niclas Hedhman" :
>
> The issue with 1-offset is that the "Register Number" found in
> documentation is at an "Address" one position less. So Reg 41 has
> Address
> 40. Som libraries expect Register Numbers and some expect Register
> Address.
> And every so often, one mixes that up.
>
> On Wed, Jul 15, 2020 at 2:53 PM Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > 
> >
> > While looking for more Infos I found out I once wrote a tutorial
> page for
> > PLC4X __
> >
> > https://plc4x.apache.org/users/plc4j/virtual-modbus.html
> >
> > I so totally hate searching the web and getting my answers answered
> by
> > myself.
> >
> > Chris
> >
> > Am 15.07.20, 08:31 schrieb "Christofer Dutz" <
> christofer.d...@c-ware.de>:
> >
> > Hi Niclas,
> >
> > when preparing a workshop for the Building IoT we were looking
> for
> > something where you could simulate a Modbus Slave.
> > Most of these were Windows only solutions, so ModbusPAL was one
> of the
> > very few solutions that were pure-java.
> >
> > Don't quite understand what the thing with the offset is however
> ...
> > should be easy to fix ... I mean if I say address 42 in PLC4X,
> Wireshark
> > says 42, but in Modbus Pal I think it has to be 43 ... don't quite
> get it.
> >
> > Chris
> >
> >
> >
> > Am 15.07.20, 03:54 schrieb "Niclas Hedhman"  >:
> >
> > What is ModbusPAL?
> >
> > The 1-offset in Modbus has caused a lot of confusion over 
the
> > years.
> >
> > On Tue, Jul 14, 2020 at 11:03 PM Christofer Dutz <
> > christofer.d...@c-ware.de>
> > wrote:
> >
> > > Sorry for the noise ...
> > >
> > > this was a false positive ... the driver was doing things
> > correctly.
> > > It seems the ModbusPAL was just off by one ;-)
> > >
> > > Chris
> > >
> > >
> > >
> > > Am 14.07.20, 15:51 schrieb "Christofer Dutz (Jira)" <
> > j...@apache.org>:
> > >
> > > Christofer Dutz created PLC4X-214:
> > > -
> > >
> > >  Summary: [Modbus] Holding register
> addresses
   

Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Niclas Hedhman
Personall, I prefer that Register Numbers are used in APIs and that the
address is only seen if you analyze the over-the-wire format, but maybe
that is just me. A big reason for this is that any interface presented to
an operator would need to use RegNumbers, as most (possibly all)
documentation of equipment has RegNumbers and some are lacking the
addresses. It is also common that the register type is part of the Register
Number, such as 10012, where the first 1 indicates "coil" (IIRC). and
holding registers are in 4. Ideally(!), this is also handled by the
register/address parser.

Niclas

On Wed, Jul 15, 2020 at 5:43 PM Christofer Dutz 
wrote:

> Hmm .. so are we doing it correctly?
>
> I mean Wireshark isn't the ideal reference here as I have several valid
> packets in the KNX space, where WireShark just says "corrupt package".
>
> So if you enter an "holding-register:42" address it tries to read the
> register number 43 in ModbusPAL.
>
> I guess as we are reading an "address" we are correct and probably as
> ModusPAL says register number, that might be correct too?
>
> Chris
>
>
> Am 15.07.20, 10:54 schrieb "Niclas Hedhman" :
>
> The issue with 1-offset is that the "Register Number" found in
> documentation is at an "Address" one position less. So Reg 41 has
> Address
> 40. Som libraries expect Register Numbers and some expect Register
> Address.
> And every so often, one mixes that up.
>
> On Wed, Jul 15, 2020 at 2:53 PM Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > 
> >
> > While looking for more Infos I found out I once wrote a tutorial
> page for
> > PLC4X __
> >
> > https://plc4x.apache.org/users/plc4j/virtual-modbus.html
> >
> > I so totally hate searching the web and getting my answers answered
> by
> > myself.
> >
> > Chris
> >
> > Am 15.07.20, 08:31 schrieb "Christofer Dutz" <
> christofer.d...@c-ware.de>:
> >
> > Hi Niclas,
> >
> > when preparing a workshop for the Building IoT we were looking
> for
> > something where you could simulate a Modbus Slave.
> > Most of these were Windows only solutions, so ModbusPAL was one
> of the
> > very few solutions that were pure-java.
> >
> > Don't quite understand what the thing with the offset is however
> ...
> > should be easy to fix ... I mean if I say address 42 in PLC4X,
> Wireshark
> > says 42, but in Modbus Pal I think it has to be 43 ... don't quite
> get it.
> >
> > Chris
> >
> >
> >
> > Am 15.07.20, 03:54 schrieb "Niclas Hedhman"  >:
> >
> > What is ModbusPAL?
> >
> > The 1-offset in Modbus has caused a lot of confusion over the
> > years.
> >
> > On Tue, Jul 14, 2020 at 11:03 PM Christofer Dutz <
> > christofer.d...@c-ware.de>
> > wrote:
> >
> > > Sorry for the noise ...
> > >
> > > this was a false positive ... the driver was doing things
> > correctly.
> > > It seems the ModbusPAL was just off by one ;-)
> > >
> > > Chris
> > >
> > >
> > >
> > > Am 14.07.20, 15:51 schrieb "Christofer Dutz (Jira)" <
> > j...@apache.org>:
> > >
> > > Christofer Dutz created PLC4X-214:
> > > -
> > >
> > >  Summary: [Modbus] Holding register
> addresses
> > have an
> > > offset of 1 (Not reading the correct address)
> > >  Key: PLC4X-214
> > >  URL:
> > https://issues.apache.org/jira/browse/PLC4X-214
> > >  Project: Apache PLC4X
> > >   Issue Type: Bug
> > >   Components: Driver-Modbus
> > > Affects Versions: 0.7.0
> > > Reporter: Christofer Dutz
> > > Assignee: Christofer Dutz
> > >  Fix For: 0.8.0
> > >
> > >
> > > If I set holding the following holding registers to:
> > >
> > > 1000: 41
> > > 1001: 42
> > > 1002: 43
> > >
> > > And then read: holding-register:1001 ... I get the
> value 43
> > returned.
> > >
> > >
> > >
> > > --
> > > This message was sent by Atlassian Jira
> > > (v8.3.4#803005)
> > >
> > >
> >
> >
> >
>
>


Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Christofer Dutz
Hmm .. so are we doing it correctly?

I mean Wireshark isn't the ideal reference here as I have several valid packets 
in the KNX space, where WireShark just says "corrupt package".

So if you enter an "holding-register:42" address it tries to read the register 
number 43 in ModbusPAL.

I guess as we are reading an "address" we are correct and probably as ModusPAL 
says register number, that might be correct too?

Chris


Am 15.07.20, 10:54 schrieb "Niclas Hedhman" :

The issue with 1-offset is that the "Register Number" found in
documentation is at an "Address" one position less. So Reg 41 has Address
40. Som libraries expect Register Numbers and some expect Register Address.
And every so often, one mixes that up.

On Wed, Jul 15, 2020 at 2:53 PM Christofer Dutz 
wrote:

> 
>
> While looking for more Infos I found out I once wrote a tutorial page for
> PLC4X __
>
> https://plc4x.apache.org/users/plc4j/virtual-modbus.html
>
> I so totally hate searching the web and getting my answers answered by
> myself.
>
> Chris
>
> Am 15.07.20, 08:31 schrieb "Christofer Dutz" :
>
> Hi Niclas,
>
> when preparing a workshop for the Building IoT we were looking for
> something where you could simulate a Modbus Slave.
> Most of these were Windows only solutions, so ModbusPAL was one of the
> very few solutions that were pure-java.
>
> Don't quite understand what the thing with the offset is however ...
> should be easy to fix ... I mean if I say address 42 in PLC4X, Wireshark
> says 42, but in Modbus Pal I think it has to be 43 ... don't quite get it.
>
> Chris
>
>
>
> Am 15.07.20, 03:54 schrieb "Niclas Hedhman" :
>
> What is ModbusPAL?
>
> The 1-offset in Modbus has caused a lot of confusion over the
> years.
>
> On Tue, Jul 14, 2020 at 11:03 PM Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > Sorry for the noise ...
> >
> > this was a false positive ... the driver was doing things
> correctly.
> > It seems the ModbusPAL was just off by one ;-)
> >
> > Chris
> >
> >
> >
> > Am 14.07.20, 15:51 schrieb "Christofer Dutz (Jira)" <
> j...@apache.org>:
> >
> > Christofer Dutz created PLC4X-214:
> > -
> >
> >  Summary: [Modbus] Holding register addresses
> have an
> > offset of 1 (Not reading the correct address)
> >  Key: PLC4X-214
> >  URL:
> https://issues.apache.org/jira/browse/PLC4X-214
> >  Project: Apache PLC4X
> >   Issue Type: Bug
> >   Components: Driver-Modbus
> > Affects Versions: 0.7.0
> > Reporter: Christofer Dutz
> > Assignee: Christofer Dutz
> >  Fix For: 0.8.0
> >
> >
> > If I set holding the following holding registers to:
> >
> > 1000: 41
> > 1001: 42
> > 1002: 43
> >
> > And then read: holding-register:1001 ... I get the value 43
> returned.
> >
> >
> >
> > --
> > This message was sent by Atlassian Jira
> > (v8.3.4#803005)
> >
> >
>
>
>



Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Niclas Hedhman
The issue with 1-offset is that the "Register Number" found in
documentation is at an "Address" one position less. So Reg 41 has Address
40. Som libraries expect Register Numbers and some expect Register Address.
And every so often, one mixes that up.

On Wed, Jul 15, 2020 at 2:53 PM Christofer Dutz 
wrote:

> 
>
> While looking for more Infos I found out I once wrote a tutorial page for
> PLC4X __
>
> https://plc4x.apache.org/users/plc4j/virtual-modbus.html
>
> I so totally hate searching the web and getting my answers answered by
> myself.
>
> Chris
>
> Am 15.07.20, 08:31 schrieb "Christofer Dutz" :
>
> Hi Niclas,
>
> when preparing a workshop for the Building IoT we were looking for
> something where you could simulate a Modbus Slave.
> Most of these were Windows only solutions, so ModbusPAL was one of the
> very few solutions that were pure-java.
>
> Don't quite understand what the thing with the offset is however ...
> should be easy to fix ... I mean if I say address 42 in PLC4X, Wireshark
> says 42, but in Modbus Pal I think it has to be 43 ... don't quite get it.
>
> Chris
>
>
>
> Am 15.07.20, 03:54 schrieb "Niclas Hedhman" :
>
> What is ModbusPAL?
>
> The 1-offset in Modbus has caused a lot of confusion over the
> years.
>
> On Tue, Jul 14, 2020 at 11:03 PM Christofer Dutz <
> christofer.d...@c-ware.de>
> wrote:
>
> > Sorry for the noise ...
> >
> > this was a false positive ... the driver was doing things
> correctly.
> > It seems the ModbusPAL was just off by one ;-)
> >
> > Chris
> >
> >
> >
> > Am 14.07.20, 15:51 schrieb "Christofer Dutz (Jira)" <
> j...@apache.org>:
> >
> > Christofer Dutz created PLC4X-214:
> > -
> >
> >  Summary: [Modbus] Holding register addresses
> have an
> > offset of 1 (Not reading the correct address)
> >  Key: PLC4X-214
> >  URL:
> https://issues.apache.org/jira/browse/PLC4X-214
> >  Project: Apache PLC4X
> >   Issue Type: Bug
> >   Components: Driver-Modbus
> > Affects Versions: 0.7.0
> > Reporter: Christofer Dutz
> > Assignee: Christofer Dutz
> >  Fix For: 0.8.0
> >
> >
> > If I set holding the following holding registers to:
> >
> > 1000: 41
> > 1001: 42
> > 1002: 43
> >
> > And then read: holding-register:1001 ... I get the value 43
> returned.
> >
> >
> >
> > --
> > This message was sent by Atlassian Jira
> > (v8.3.4#803005)
> >
> >
>
>
>


Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Christofer Dutz


While looking for more Infos I found out I once wrote a tutorial page for PLC4X 
__

https://plc4x.apache.org/users/plc4j/virtual-modbus.html

I so totally hate searching the web and getting my answers answered by myself.

Chris

Am 15.07.20, 08:31 schrieb "Christofer Dutz" :

Hi Niclas,

when preparing a workshop for the Building IoT we were looking for 
something where you could simulate a Modbus Slave.
Most of these were Windows only solutions, so ModbusPAL was one of the very 
few solutions that were pure-java.

Don't quite understand what the thing with the offset is however ... should 
be easy to fix ... I mean if I say address 42 in PLC4X, Wireshark says 42, but 
in Modbus Pal I think it has to be 43 ... don't quite get it.

Chris



Am 15.07.20, 03:54 schrieb "Niclas Hedhman" :

What is ModbusPAL?

The 1-offset in Modbus has caused a lot of confusion over the years.

On Tue, Jul 14, 2020 at 11:03 PM Christofer Dutz 

wrote:

> Sorry for the noise ...
>
> this was a false positive ... the driver was doing things correctly.
> It seems the ModbusPAL was just off by one ;-)
>
> Chris
>
>
>
> Am 14.07.20, 15:51 schrieb "Christofer Dutz (Jira)" :
>
> Christofer Dutz created PLC4X-214:
> -
>
>  Summary: [Modbus] Holding register addresses have an
> offset of 1 (Not reading the correct address)
>  Key: PLC4X-214
>  URL: 
https://issues.apache.org/jira/browse/PLC4X-214
>  Project: Apache PLC4X
>   Issue Type: Bug
>   Components: Driver-Modbus
> Affects Versions: 0.7.0
> Reporter: Christofer Dutz
> Assignee: Christofer Dutz
>  Fix For: 0.8.0
>
>
> If I set holding the following holding registers to:
>
> 1000: 41
> 1001: 42
> 1002: 43
>
> And then read: holding-register:1001 ... I get the value 43 
returned.
>
>
>
> --
> This message was sent by Atlassian Jira
> (v8.3.4#803005)
>
>




Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-15 Thread Christofer Dutz
Hi Niclas,

when preparing a workshop for the Building IoT we were looking for something 
where you could simulate a Modbus Slave.
Most of these were Windows only solutions, so ModbusPAL was one of the very few 
solutions that were pure-java.

Don't quite understand what the thing with the offset is however ... should be 
easy to fix ... I mean if I say address 42 in PLC4X, Wireshark says 42, but in 
Modbus Pal I think it has to be 43 ... don't quite get it.

Chris



Am 15.07.20, 03:54 schrieb "Niclas Hedhman" :

What is ModbusPAL?

The 1-offset in Modbus has caused a lot of confusion over the years.

On Tue, Jul 14, 2020 at 11:03 PM Christofer Dutz 
wrote:

> Sorry for the noise ...
>
> this was a false positive ... the driver was doing things correctly.
> It seems the ModbusPAL was just off by one ;-)
>
> Chris
>
>
>
> Am 14.07.20, 15:51 schrieb "Christofer Dutz (Jira)" :
>
> Christofer Dutz created PLC4X-214:
> -
>
>  Summary: [Modbus] Holding register addresses have an
> offset of 1 (Not reading the correct address)
>  Key: PLC4X-214
>  URL: https://issues.apache.org/jira/browse/PLC4X-214
>  Project: Apache PLC4X
>   Issue Type: Bug
>   Components: Driver-Modbus
> Affects Versions: 0.7.0
> Reporter: Christofer Dutz
> Assignee: Christofer Dutz
>  Fix For: 0.8.0
>
>
> If I set holding the following holding registers to:
>
> 1000: 41
> 1001: 42
> 1002: 43
>
> And then read: holding-register:1001 ... I get the value 43 returned.
>
>
>
> --
> This message was sent by Atlassian Jira
> (v8.3.4#803005)
>
>



Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-14 Thread Niclas Hedhman
What is ModbusPAL?

The 1-offset in Modbus has caused a lot of confusion over the years.

On Tue, Jul 14, 2020 at 11:03 PM Christofer Dutz 
wrote:

> Sorry for the noise ...
>
> this was a false positive ... the driver was doing things correctly.
> It seems the ModbusPAL was just off by one ;-)
>
> Chris
>
>
>
> Am 14.07.20, 15:51 schrieb "Christofer Dutz (Jira)" :
>
> Christofer Dutz created PLC4X-214:
> -
>
>  Summary: [Modbus] Holding register addresses have an
> offset of 1 (Not reading the correct address)
>  Key: PLC4X-214
>  URL: https://issues.apache.org/jira/browse/PLC4X-214
>  Project: Apache PLC4X
>   Issue Type: Bug
>   Components: Driver-Modbus
> Affects Versions: 0.7.0
> Reporter: Christofer Dutz
> Assignee: Christofer Dutz
>  Fix For: 0.8.0
>
>
> If I set holding the following holding registers to:
>
> 1000: 41
> 1001: 42
> 1002: 43
>
> And then read: holding-register:1001 ... I get the value 43 returned.
>
>
>
> --
> This message was sent by Atlassian Jira
> (v8.3.4#803005)
>
>


Re: [jira] [Created] (PLC4X-214) [Modbus] Holding register addresses have an offset of 1 (Not reading the correct address)

2020-07-14 Thread Christofer Dutz
Sorry for the noise ... 

this was a false positive ... the driver was doing things correctly. 
It seems the ModbusPAL was just off by one ;-)

Chris



Am 14.07.20, 15:51 schrieb "Christofer Dutz (Jira)" :

Christofer Dutz created PLC4X-214:
-

 Summary: [Modbus] Holding register addresses have an offset of 
1 (Not reading the correct address)
 Key: PLC4X-214
 URL: https://issues.apache.org/jira/browse/PLC4X-214
 Project: Apache PLC4X
  Issue Type: Bug
  Components: Driver-Modbus
Affects Versions: 0.7.0
Reporter: Christofer Dutz
Assignee: Christofer Dutz
 Fix For: 0.8.0


If I set holding the following holding registers to:

1000: 41
1001: 42
1002: 43

And then read: holding-register:1001 ... I get the value 43 returned.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)