Skip to content

Commit

Permalink
Add changes for bfc203c
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Apr 16, 2024
1 parent 77276af commit 5344793
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 62 deletions.
17 changes: 9 additions & 8 deletions _sources/creating_driver.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ Creating a **modbus** port driver
---------------------------------

Before **modbus** port drivers can be created, it is necessary to first
create at least one asyn TCP/IP or serial port driver to communicate
create at least one asyn TCP/IP, UDP/IP or serial port driver to communicate
with the hardware. The commands required depend on the communications
link being used.

TCP/IP
~~~~~~
TCP/IP UDP/IP
~~~~~~~~~~~~~

For TCP/IP use the following standard asyn command:
For TCP/IP or UDP/IP use the following standard asyn command:

::

Expand All @@ -31,6 +31,7 @@ the asynInterpose interface does no harm.
However, the asynInterposeEos interface is definitely needed when using drvAsynIPPortConfigure to talk
to a terminal server that is communicating with the Modbus device over Modbus RTU or ASCII,
because then the communication from the device may well be broken up into multiple packets.
To use UDP rather than TCP, add " UDP" after the host name/number and optional port number.

::

Expand Down Expand Up @@ -105,7 +106,7 @@ modbusInterposeConfig
After creating the asynIPPort or asynSerialPort driver, the next step is
to add the asyn "interpose interface" driver. This driver takes the
device-independent Modbus frames and adds or removes the
communication-link specific information for the TCP, RTU, or ASCII link
communication-link specific information for the TCP, UDP, RTU, or ASCII link
protocols. The interpose driver is created with the command:

::
Expand All @@ -128,7 +129,7 @@ protocols. The interpose driver is created with the command:
- Name of the asynIPPort or asynSerialPort previously created.
* - linkType
- int
- Modbus link layer type:, 0 = TCP/IP, 1 = RTU, 2 = ASCII
- Modbus link layer type:, 0 = TCP/IP, 1 = RTU, 2 = ASCII, 3 = UDP/IP
* - timeoutMsec
- int
- The timeout in milliseconds for write and read operations to the underlying asynOctet
Expand Down Expand Up @@ -186,7 +187,7 @@ created with the following command:
* - slaveAddress
- int
- The address of the Modbus slave. This must match the configuration of the Modbus
slave (PLC) for RTU and ASCII. For TCP the slave address is used for the "unit identifier",
slave (PLC) for RTU and ASCII. For TCP or UDP the slave address is used for the "unit identifier",
the last field in the MBAP header. The "unit identifier" is ignored by most PLCs,
but may be required by some.
* - modbusFunction
Expand Down Expand Up @@ -454,4 +455,4 @@ Number formats
It can be convenient to specify the modbusStartAddress and modbusLength
in octal, rather than decimal, because this is the convention on most
PLCs. In the iocsh and vxWorks shells this is done by using a leading 0
on the number, i.e. 040400 is an octal number.
on the number, i.e. 040400 is an octal number.
6 changes: 6 additions & 0 deletions _sources/overview.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ Modbus supports the following 3 communication-link layers:
- Description
* - TCP
- TCP/IP using standard port 502.
* - UDP
- UDP/IP using standard port 502. The use of UDP/IP is not part of the MODBUS
- standard but is useful for FPGAs with Ethernet in firmware which may provide
- support only for UDP. The only difference between TCP and UDP operation is
- that when using UDP a missing reply packet is not considered to
- be an error until the transaction has been attempted 5 times.
* - RTU
- RTU is normally run over serial communication links, i.e. RS-232,
RS-422, or RS-485. RTU uses an additional CRC for packet checking. The
Expand Down
2 changes: 1 addition & 1 deletion acknowledgments.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ <h1>Acknowledgments<a class="headerlink" href="#acknowledgments" title="Link to

<div role="contentinfo">
<p>&#169; Copyright 2023, Mark Rivers.
<span class="lastupdated">Last updated on 2024-March-25.
<span class="lastupdated">Last updated on 2024-April-16.
</span></p>
</div>

Expand Down
21 changes: 11 additions & 10 deletions creating_driver.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<li class="toctree-l1"><a class="reference internal" href="overview.html">Overview of Modbus</a></li>
<li class="toctree-l1"><a class="reference internal" href="driver_architecture.html">Driver architecture</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Creating a <strong>modbus</strong> port driver</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#tcp-ip">TCP/IP</a></li>
<li class="toctree-l2"><a class="reference internal" href="#tcp-ip-udp-ip">TCP/IP UDP/IP</a></li>
<li class="toctree-l2"><a class="reference internal" href="#serial-rtu">Serial RTU</a></li>
<li class="toctree-l2"><a class="reference internal" href="#serial-ascii">Serial ASCII</a></li>
<li class="toctree-l2"><a class="reference internal" href="#modbusinterposeconfig">modbusInterposeConfig</a></li>
Expand Down Expand Up @@ -93,12 +93,12 @@
<section id="creating-a-modbus-port-driver">
<h1>Creating a <strong>modbus</strong> port driver<a class="headerlink" href="#creating-a-modbus-port-driver" title="Link to this heading"></a></h1>
<p>Before <strong>modbus</strong> port drivers can be created, it is necessary to first
create at least one asyn TCP/IP or serial port driver to communicate
create at least one asyn TCP/IP, UDP/IP or serial port driver to communicate
with the hardware. The commands required depend on the communications
link being used.</p>
<section id="tcp-ip">
<h2>TCP/IP<a class="headerlink" href="#tcp-ip" title="Link to this heading"></a></h2>
<p>For TCP/IP use the following standard asyn command:</p>
<section id="tcp-ip-udp-ip">
<h2>TCP/IP UDP/IP<a class="headerlink" href="#tcp-ip-udp-ip" title="Link to this heading"></a></h2>
<p>For TCP/IP or UDP/IP use the following standard asyn command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">drvAsynIPPortConfigure</span><span class="p">(</span><span class="n">portName</span><span class="p">,</span> <span class="n">hostInfo</span><span class="p">,</span> <span class="n">priority</span><span class="p">,</span> <span class="n">noAutoConnect</span><span class="p">,</span> <span class="n">noProcessEos</span><span class="p">)</span>
</pre></div>
</div>
Expand All @@ -116,7 +116,8 @@ <h2>TCP/IP<a class="headerlink" href="#tcp-ip" title="Link to this heading"><
the asynInterpose interface does no harm.
However, the asynInterposeEos interface is definitely needed when using drvAsynIPPortConfigure to talk
to a terminal server that is communicating with the Modbus device over Modbus RTU or ASCII,
because then the communication from the device may well be broken up into multiple packets.</p>
because then the communication from the device may well be broken up into multiple packets.
To use UDP rather than TCP, add “ UDP” after the host name/number and optional port number.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">drvAsynIPPortConfigure</span><span class="p">(</span><span class="s2">&quot;Koyo1&quot;</span><span class="p">,</span><span class="s2">&quot;164.54.160.158:502&quot;</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span>
</pre></div>
</div>
Expand Down Expand Up @@ -179,7 +180,7 @@ <h2>modbusInterposeConfig<a class="headerlink" href="#modbusinterposeconfig" tit
<p>After creating the asynIPPort or asynSerialPort driver, the next step is
to add the asyn “interpose interface” driver. This driver takes the
device-independent Modbus frames and adds or removes the
communication-link specific information for the TCP, RTU, or ASCII link
communication-link specific information for the TCP, UDP, RTU, or ASCII link
protocols. The interpose driver is created with the command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">modbusInterposeConfig</span><span class="p">(</span><span class="n">portName</span><span class="p">,</span>
<span class="n">linkType</span><span class="p">,</span>
Expand All @@ -201,7 +202,7 @@ <h2>modbusInterposeConfig<a class="headerlink" href="#modbusinterposeconfig" tit
</tr>
<tr class="row-odd"><td><p>linkType</p></td>
<td><p>int</p></td>
<td><p>Modbus link layer type:, 0 = TCP/IP, 1 = RTU, 2 = ASCII</p></td>
<td><p>Modbus link layer type:, 0 = TCP/IP, 1 = RTU, 2 = ASCII, 3 = UDP/IP</p></td>
</tr>
<tr class="row-even"><td><p>timeoutMsec</p></td>
<td><p>int</p></td>
Expand Down Expand Up @@ -261,7 +262,7 @@ <h2>drvModbusAsynConfigure<a class="headerlink" href="#drvmodbusasynconfigure" t
<tr class="row-even"><td><p>slaveAddress</p></td>
<td><p>int</p></td>
<td><p>The address of the Modbus slave. This must match the configuration of the Modbus
slave (PLC) for RTU and ASCII. For TCP the slave address is used for the “unit identifier”,
slave (PLC) for RTU and ASCII. For TCP or UDP the slave address is used for the “unit identifier”,
the last field in the MBAP header. The “unit identifier” is ignored by most PLCs,
but may be required by some.</p></td>
</tr>
Expand Down Expand Up @@ -581,7 +582,7 @@ <h2>Number formats<a class="headerlink" href="#number-formats" title="Link to th

<div role="contentinfo">
<p>&#169; Copyright 2023, Mark Rivers.
<span class="lastupdated">Last updated on 2024-March-25.
<span class="lastupdated">Last updated on 2024-April-16.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion debugging.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ <h2>asynRegister.adl<a class="headerlink" href="#asynregister-adl" title="Link t

<div role="contentinfo">
<p>&#169; Copyright 2023, Mark Rivers.
<span class="lastupdated">Last updated on 2024-March-25.
<span class="lastupdated">Last updated on 2024-April-16.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion device_support.html
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ <h2>Template files<a class="headerlink" href="#template-files" title="Link to th

<div role="contentinfo">
<p>&#169; Copyright 2023, Mark Rivers.
<span class="lastupdated">Last updated on 2024-March-25.
<span class="lastupdated">Last updated on 2024-April-16.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion driver_architecture.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ <h2>Platform independence<a class="headerlink" href="#platform-independence" tit

<div role="contentinfo">
<p>&#169; Copyright 2023, Mark Rivers.
<span class="lastupdated">Last updated on 2024-March-25.
<span class="lastupdated">Last updated on 2024-April-16.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion example_applications.html
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ <h1>Example Applications<a class="headerlink" href="#example-applications" title

<div role="contentinfo">
<p>&#169; Copyright 2023, Mark Rivers.
<span class="lastupdated">Last updated on 2024-March-25.
<span class="lastupdated">Last updated on 2024-April-16.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ <h1 id="index">Index</h1>

<div role="contentinfo">
<p>&#169; Copyright 2023, Mark Rivers.
<span class="lastupdated">Last updated on 2024-March-25.
<span class="lastupdated">Last updated on 2024-April-16.
</span></p>
</div>

Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ <h2>Table of Contents<a class="headerlink" href="#table-of-contents" title="Link
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="creating_driver.html">Creating a <strong>modbus</strong> port driver</a><ul>
<li class="toctree-l2"><a class="reference internal" href="creating_driver.html#tcp-ip">TCP/IP</a></li>
<li class="toctree-l2"><a class="reference internal" href="creating_driver.html#tcp-ip-udp-ip">TCP/IP UDP/IP</a></li>
<li class="toctree-l2"><a class="reference internal" href="creating_driver.html#serial-rtu">Serial RTU</a></li>
<li class="toctree-l2"><a class="reference internal" href="creating_driver.html#serial-ascii">Serial ASCII</a></li>
<li class="toctree-l2"><a class="reference internal" href="creating_driver.html#modbusinterposeconfig">modbusInterposeConfig</a></li>
Expand Down Expand Up @@ -167,7 +167,7 @@ <h2>Table of Contents<a class="headerlink" href="#table-of-contents" title="Link

<div role="contentinfo">
<p>&#169; Copyright 2023, Mark Rivers.
<span class="lastupdated">Last updated on 2024-March-25.
<span class="lastupdated">Last updated on 2024-April-16.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion medm_screens.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ <h2>Koyo_4ADC.adl<a class="headerlink" href="#koyo-4adc-adl" title="Link to this

<div role="contentinfo">
<p>&#169; Copyright 2023, Mark Rivers.
<span class="lastupdated">Last updated on 2024-March-25.
<span class="lastupdated">Last updated on 2024-April-16.
</span></p>
</div>

Expand Down
35 changes: 2 additions & 33 deletions overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,38 +102,7 @@ <h1>Overview of Modbus<a class="headerlink" href="#overview-of-modbus" title="Li
<section id="modbus-communication-links">
<h2>Modbus communication links<a class="headerlink" href="#modbus-communication-links" title="Link to this heading"></a></h2>
<p>Modbus supports the following 3 communication-link layers:</p>
<table class="table-bordered table-striped table-hover docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Link type</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>TCP</p></td>
<td><p>TCP/IP using standard port 502.</p></td>
</tr>
<tr class="row-odd"><td><p>RTU</p></td>
<td><p>RTU is normally run over serial communication links, i.e. RS-232,
RS-422, or RS-485. RTU uses an additional CRC for packet checking. The
protocol directly transmits each byte as 8 data bits, so uses “binary”
rather than ASCII encoding. When using serial links start and end of
message frames is detected by timing rather than by specific characters.
RTU can also be run over TCP, though this is less common than the
standard Modbus TCP without RTU.</p></td>
</tr>
<tr class="row-even"><td><p>Serial ASCII</p></td>
<td><p>Serial protocol, which is normally run over serial communication links,
i.e. RS-232, RS-422, or RS-485. Serial ASCII uses an additional LRC for
packet checking. The protocol encodes each byte as 2 ASCII characters.
The start and end of message frames is detected by specific characters
(“:” to start a message and CR/LF to end a message). This protocol is
less efficient than RTU, but may be more reliable in some environments.
ASCII can also be run over TCP, though this is much less common than the
standard Modbus TCP.</p></td>
</tr>
</tbody>
</table>
<p>This <strong>modbus</strong> package supports all of the above Modbus
<p class="table-bordered table-striped table-hover">This <strong>modbus</strong> package supports all of the above Modbus
communication-link layers.</p>
</section>
<section id="modbus-data-types">
Expand Down Expand Up @@ -383,7 +352,7 @@ <h2>More information on Modbus<a class="headerlink" href="#more-information-on-m

<div role="contentinfo">
<p>&#169; Copyright 2023, Mark Rivers.
<span class="lastupdated">Last updated on 2024-March-25.
<span class="lastupdated">Last updated on 2024-April-16.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion search.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2023, Mark Rivers.
<span class="lastupdated">Last updated on 2024-March-25.
<span class="lastupdated">Last updated on 2024-April-16.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 5344793

Please sign in to comment.