ModbusSequentialDataBlock vs. ModbusSparseDataBlock

815 views
Skip to first unread message

anana

unread,
Sep 8, 2011, 5:34:22 AM9/8/11
to pymodbus
Could you briefly explain why should I use one or the other?

Thanks a lot!

ana

Albert Brandl

unread,
Sep 8, 2011, 6:42:34 AM9/8/11
to pymo...@googlegroups.com
On Thu, Sep 08, 2011 at 02:34:22AM -0700, anana wrote:
> Could you briefly explain why should I use one or the other?

It depends whether all registers are in one chunk or you have some
"holes" between registers. In the second case, a sparse data block
is the better representation.

Regards,
--
Albert Brandl
Weiermayer Solutions GmbH | Abteistra�e 12, A-4813 Altm�nster
phone: +43 (0) 720 70 30 14 | fax: +43 (0) 7612 20 3 56
web: http://www.weiermayer.com

anana

unread,
Sep 12, 2011, 6:57:37 AM9/12/11
to pymodbus
And why is it better? Only if I want to use a dictionary instead of a
list? Do I still need to initialize the DataBlock?
In my case, the following registers are set an will be read. Would
there be any advantage using Sparse Data Blocks?

DEBUG:pymodbus.datastore.context:setValues[4] 1:242
DEBUG:pymodbus.datastore.context:setValues[4] 10016:2
DEBUG:pymodbus.datastore.context:setValues[4] 10014:2
DEBUG:pymodbus.datastore.context:setValues[4] 10008:2
DEBUG:pymodbus.datastore.context:setValues[4] 10006:2
DEBUG:pymodbus.datastore.context:setValues[4] 10012:2
DEBUG:pymodbus.datastore.context:setValues[4] 10010:2
DEBUG:pymodbus.datastore.context:setValues[4] 10000:2
DEBUG:pymodbus.datastore.context:setValues[4] 10004:2
DEBUG:pymodbus.datastore.context:setValues[4] 10002:2
DEBUG:pymodbus.datastore.context:setValues[4] 10018:2
DEBUG:pymodbus.datastore.context:setValues[4] 301:1404
DEBUG:pymodbus.datastore.context:setValues[4] 20096:12
DEBUG:pymodbus.datastore.context:setValues[4] 20084:12
DEBUG:pymodbus.datastore.context:setValues[4] 20048:12
DEBUG:pymodbus.datastore.context:setValues[4] 20036:12
DEBUG:pymodbus.datastore.context:setValues[4] 20072:12
DEBUG:pymodbus.datastore.context:setValues[4] 20060:12
DEBUG:pymodbus.datastore.context:setValues[4] 20000:12
DEBUG:pymodbus.datastore.context:setValues[4] 20024:12
DEBUG:pymodbus.datastore.context:setValues[4] 20012:12
DEBUG:pymodbus.datastore.context:setValues[4] 20108:12
DEBUG:pymodbus.datastore.context:setValues[16] 1:8
DEBUG:pymodbus.datastore.context:setValues[2] 8:1
DEBUG:pymodbus.datastore.context:setValues[15] 8:1


Thank you again,

ana

On Sep 8, 12:42 pm, Albert Brandl <albert.bra...@weiermayer.com>
wrote:

Galen Collins

unread,
Sep 13, 2011, 2:51:50 AM9/13/11
to pymo...@googlegroups.com
Ana,

The real reason for the two is that I encountered devices where the
data sheet would list readable registers with gaps between (say
100-110 and 120-130). Some devices would function perfectly well
reading 100-130 (just returning 0x00), however, others would return
address errors. So that is the main point to be addressed by the two.
As for which one you should use, honestly it doesn't really matter
all that much. Which ever is easiest for you to use is fine.

Galen

anana

unread,
Sep 13, 2011, 7:03:44 AM9/13/11
to pymodbus
Thank you very much.
I will use the sparse datastore (my data also have gaps in between) in
case it, as you said, could origin uncompatibility problems with any
devices.

ana

On Sep 13, 8:51 am, Galen Collins <bashw...@gmail.com> wrote:
> Ana,
>
> The real reason for the two is that I encountered devices where the
> data sheet would list readable registers with gaps between (say
> 100-110 and 120-130).  Some devices would function perfectly well
> reading 100-130 (just returning 0x00), however, others would return
> address errors.  So that is the main point to be addressed by the two.
>  As for which one you should use, honestly it doesn't really matter
> all that much. Which ever is easiest for you to use is fine.
>
> Galen
>
Reply all
Reply to author
Forward
0 new messages