blob: 071ec66781d4086f6715fb2b8de617242ae85a48 [file]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Example: DF1 MSpec :: PLC4X</title>
<meta name="generator" content="Antora 3.1.14">
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<link rel="stylesheet" href="/_/css/site.css">
<link rel="stylesheet" href="/_/css/header.css">
<link rel="stylesheet" href="/_/css/vars.css">
<link rel="stylesheet" href="/_/css/all.min.css" type="text/css"/>
<script src="https://www.apachecon.com/event-images/snippet.js" type="text/javascript"></script>
<link rel="icon" type="image/x-icon" href="/images/favicon.ico"> </head>
<body class="article">
<header class="header">
<nav class="navbar">
<div class="navbar-brand">
<a class="navbar-item" href="../../../../..">
<img src="../../../../../plc4x/pre-release/_images/apache-plc4x-oakleaf-dark-small.png" alt="Apache PLC4X">
</a>
<div class="navbar-item search hide-for-print">
<div id="search-field" class="field">
<input id="search-input" type="text" placeholder="Search the docs">
</div>
</div>
<button class="navbar-burger" aria-controls="topbar-nav" aria-expanded="false" aria-label="Toggle main menu">
<span></span>
<span></span>
<span></span>
</button>
</div>
<div id="topbar-nav" class="navbar-menu">
<div class="navbar-end justify-content-center">
<a class="navbar-item" href="../../../../../">Home</a>
<a class="navbar-item" href="../../../../../plc4x/pre-release/users">Users</a>
<a class="navbar-item" href="../../../../../plc4x/pre-release/developers">Developers</a>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link" href="https://www.apache.org">Apache</a>
<div class="navbar-dropdown">
<a class="navbar-item" href="https://www.apache.org">Apache Homepage</a>
<a class="navbar-item" href="https://www.apache.org/licenses/">License</a>
<a class="navbar-item" href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a>
<a class="navbar-item" href="https://www.apache.org/foundation/thanks.html">Thanks</a>
<a class="navbar-item" href="https://www.apache.org/security/">Security</a>
<a class="navbar-item" href="https://privacy.apache.org/policies/privacy-policy-public.html">Privacy</a>
<a class="navbar-item" href="https://www.apache.org/foundation/policies/conduct">Code of Conduct</a>
<a class="navbar-item" href="https://events.apache.org/">Upcoming Events</a>
</div>
</div>
<div class="navbar-item">
<span class="control">
<a class="fa-brands fa-github" href="https://github.com/apache/plc4x"></a>
</span>
</div>
<div class="navbar-item">
<span class="control">
<a class="button is-primary" href="../../../../../plc4x/pre-release/users/download.html">Download</a>
</span>
</div>
<a class="acevent" data-format="wide"></a>
</div>
</div>
</nav>
</header>
<div class="body">
<div class="nav-container" data-component="plc4x" data-version="pre-release">
<aside class="nav">
<div class="panels">
<div class="nav-panel-menu is-active" data-panel="menu">
<nav class="nav-menu">
<button class="nav-menu-toggle" aria-label="Toggle expand/collapse all" style="display: none"></button>
<h3 class="title"><a href="../../../users/index.html">PLC4X</a></h3>
<ul class="nav-list">
<li class="nav-item" data-depth="0">
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../../users/index.html">Users</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../../users/download.html">Download</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../../users/adopters.html">Adopters</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../../users/issues.html">Bug &amp; Issue Tracker</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../../users/commercial-support.html">Commercial Support</a>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../../users/getting-started/index.html">Getting Started</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/getting-started/plc4c.html">Getting Started with C</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/getting-started/plc4cs.html">Getting Started with C#</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/getting-started/plc4go.html">Getting Started with Go</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/getting-started/plc4j.html">Getting Started with Java</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/getting-started/plc4py.html">Getting Started with Python</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/getting-started/using-snapshots.html">Using SNAPSHOT versions</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/getting-started/general-concepts.html">General Concepts</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/getting-started/virtual-modbus.html">Virtual Modbus</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/getting-started/opcua-client-certificate.html">OPC UA : Client certificate creation</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../../users/blogs-videos-and-slides.html">Blogs, Videos and Slides on Apache PLC4X</a>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../../users/protocols/index.html">Protocols</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/ab-eth.html">AB-ETH</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/ads.html">ADS (Automation Device Specification)</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/bacnet.html">BACnet/IP</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/c-bus.html">C-Bus</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/canopen.html">CANopen</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/ctrlx.html">CtlrX</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/deltav.html">DeltaV</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/df1.html">DF1</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/eip.html">EtherNet/IP</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/firmata.html">Firmata</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/genericcan.html">Generic CAN</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/iec-60870.html">IEC-60870</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/knxnetip.html">KNXnet/IP</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/logix.html">Logix</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/modbus.html">Modbus (TCP/UDP/Serial)</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/opcua.html">OPC UA</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/open-protocol.html">Open-Protocol (Torque-Tools)</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/plc4x.html">PLC4X (Proxy) (TCP)</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/profinet.html">Profinet (In Development)</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/s7.html">S7 (Step7)</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/s7-light.html">S7-Light (Step7)</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/simulated.html">Simulated</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/protocols/umas.html">UMAS (Schneider Electric PLCs)</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../../users/transports/index.html">Transports</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/transports/tcp.html">TCP</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/transports/udp.html">UDP</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/transports/serial.html">Serial Port</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/transports/socketcan.html">SocketCAN</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/transports/raw-socket.html">Raw Socket</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/transports/pcap-replay.html">PCAP Replay</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../../users/integrations/index.html">Integrations</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/integrations/apache-calcite.html">Apache Calcite</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/integrations/apache-camel.html">Apache Camel</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/integrations/apache-iotdb.html">Apache IotDB</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/integrations/apache-kafka.html">Apache Kafka</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/integrations/apache-nifi.html">Apache NiFi</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/integrations/apache-streampipes.html">Apache StreamPipes</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/integrations/eclipse-ditto.html">Eclipse Ditto</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/integrations/eclipse-milo.html">Eclipse Milo (OPC UA Server)</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../../users/tools/index.html">Tools</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/tools/capture-replay.html">Capture Replay</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/tools/connection-cache.html">The Connection Cache concept</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/tools/opm.html">Object PLC Mapping</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/tools/scraper.html">Scraper</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../../users/tools/testing.html">Testing (or using PLC4X without a PLC)</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../../users/industry40.html">Industry 4.0 with Apache</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../../users/security.html">Security Vulnerabilities</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-depth="0">
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../index.html">Developers</a>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../preparing/index.html">Preparing your Computer</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../preparing/linux.html">Linux</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../preparing/macos.html">Mac OS</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../preparing/windows.html">Windows</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../building.html">Building PLC4X</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../contributing.html">Contributing</a>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../tutorials/index.html">Tutorials</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../tutorials/writing-driver.html">Strategy for creating a new Driver</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../tutorials/testing-serializers-and-parsers.html">Testing Serializers and Parsers</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../index.html">Code Generation</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="mspec.html">The MSpec format</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../language/freemarker.html">Apache Freemarker</a>
</li>
<li class="nav-item is-current-page" data-depth="3">
<a class="nav-link" href="df1.html">Example: DF1 MSpec</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../protocols/index.html">Usage of protocols</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../protocols/ads/protocol.html">Beckhoff ADS Protocol</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../protocols/eip/protocol.html">EIP Protocol</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../infrastructure/index.html">Infrastructure</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../infrastructure/ci.html">Continuous Integration</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../infrastructure/issues.html">Bug &amp; Issue Tracker</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../infrastructure/sonar.html">Code Analysis</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../infrastructure/wiki.html">WIKI</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../infrastructure/vm.html">The PLC4X Project VM</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../infrastructure/website.html">Generating the Website</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<button class="nav-item-toggle"></button>
<a class="nav-link" href="../../release/index.html">Releasing and Validating Releases</a>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../release/release.html">Releasing PLC4X</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../release/extras.html">Releasing PLC4X-Extras</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../release/validation.html">Validating a staged release</a>
</li>
<li class="nav-item" data-depth="3">
<a class="nav-link" href="../../release/build-tools.html">Releasing PLC4X Build-Tools</a>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../testing/index.html">Setup for testing</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../tools.html">Tools</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../team.html">Team</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../decisions.html">Decision Making</a>
</li>
<li class="nav-item" data-depth="2">
<a class="nav-link" href="../../maturity.html">Apache Maturity Model Assessment for PLC4X</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="nav-panel-explore" data-panel="explore">
<div class="context">
<span class="title">PLC4X</span>
<span class="version">pre-release</span>
</div>
<ul class="components">
<li class="component is-current">
<div class="title"><a href="../../../../latest/users/index.html">PLC4X</a></div>
<ul class="versions">
<li class="version is-current">
<a href="../../../users/index.html">pre-release</a>
</li>
<li class="version is-latest">
<a href="../../../../latest/users/index.html">latest</a>
</li>
<li class="version">
<a href="../../../../0.12.0/users/index.html">0.12.0</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
</aside>
</div>
<main class="article">
<div class="toolbar" role="navigation">
<button class="nav-toggle"></button>
<nav class="breadcrumbs" aria-label="breadcrumbs">
<ul>
<li><a href="../../../users/index.html">PLC4X</a></li>
<li><a href="../../index.html">Developers</a></li>
<li><a href="../index.html">Code Generation</a></li>
<li><a href="df1.html">Example: DF1 MSpec</a></li>
</ul>
</nav>
<div class="page-versions">
<button class="version-menu-toggle" title="Show other versions of page">pre-release</button>
<div class="version-menu">
<a class="version is-current" href="df1.html">pre-release</a>
<a class="version" href="../../../../latest/developers/code-gen/protocol/df1.html">latest</a>
<a class="version" href="../../../../0.12.0/developers/code-gen/protocol/df1.html">0.12.0</a>
</div>
</div>
<div class="edit-this-page"><a href="https://github.com/apache/plc4x/edit/develop/website/asciidoc/modules/developers/pages/code-gen/protocol/df1.adoc">Edit this Page</a></div>
</div>
<div class="content">
<aside class="toc sidebar" data-title="Contents" data-levels="2">
<div class="toc-menu"></div>
</aside>
<article class="doc">
<h1 class="page">Example: DF1 MSpec</h1>
<div class="paragraph">
<p>The DF1 protocol has three basic messages: a command message, acknowledge and not acknowledge.
A <code>0x10</code> is used as delimiter to differentiate between the messages and parts of the command message.</p>
</div>
<table class="tableblock frame-all grid-all" style="width: 25%;">
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-center valign-top">ACK</th>
<th class="tableblock halign-center valign-top">NAK</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-center valign-top"><p class="tableblock">10 06</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">10 15</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>This is what a read command message looks like in full-duplex mode using CRC as checksum:</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6924%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-center valign-top">Name</th>
<th class="tableblock halign-center valign-top">DLE</th>
<th class="tableblock halign-center valign-top">STX</th>
<th class="tableblock halign-center valign-top">DST</th>
<th class="tableblock halign-center valign-top">SRC</th>
<th class="tableblock halign-center valign-top">CMD</th>
<th class="tableblock halign-center valign-top">STS</th>
<th class="tableblock halign-center valign-top">TNS</th>
<th class="tableblock halign-center valign-top">ADDR</th>
<th class="tableblock halign-center valign-top">SIZE</th>
<th class="tableblock halign-center valign-top">DLE</th>
<th class="tableblock halign-center valign-top">ETX</th>
<th class="tableblock halign-center valign-top">CRC</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-center valign-top"><p class="tableblock">Value</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">10</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">02</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">XX</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">XX</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">01</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">00</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">XX XX</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">XX XX</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">02</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">10</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">03</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">XX XX</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>The according response with the requested byte data:</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6923%;">
<col style="width: 7.6924%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-center valign-top">Name</th>
<th class="tableblock halign-center valign-top">DLE</th>
<th class="tableblock halign-center valign-top">STX</th>
<th class="tableblock halign-center valign-top">DST</th>
<th class="tableblock halign-center valign-top">SRC</th>
<th class="tableblock halign-center valign-top">CMD</th>
<th class="tableblock halign-center valign-top">STS</th>
<th class="tableblock halign-center valign-top">TNS</th>
<th class="tableblock halign-center valign-top">DATA</th>
<th class="tableblock halign-center valign-top">SIZE</th>
<th class="tableblock halign-center valign-top">DLE</th>
<th class="tableblock halign-center valign-top">ETX</th>
<th class="tableblock halign-center valign-top">CRC</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-center valign-top"><p class="tableblock">Value</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">10</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">02</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">XX</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">XX</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">41</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">00</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">XX XX</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">XX XX</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">02</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">10</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">03</p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">XX XX</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>Every message starts with a <code>DLE = 0x10</code>. The second byte is used to differentiate what type of message will follow.
In the case of a command message it is <code>0x02</code>. DST and SRC specify the target and source of the message.
<code>CMD = 0x01</code> means an unprotected read is requested, the command response code is always attained with the addition of <code>0x40</code>. STS is a status byte,
TNS is the transaction counter that is incremented by the master and used to recognize the specific message response.
ADDR is the memory address being requested, size specifies how many bytes are to be read.
DLE + ETX mark the end of the message, the last two bytes are the CRC that is calculated using the previously sent bytes.</p>
</div>
<div class="paragraph">
<p>Here is the MSpec to model the behaviour:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>[discriminatedType DF1Symbol
[const uint 8 messageStart 0x10]
[discriminator uint 8 symbolType]
[typeSwitch 'symbolType'
['0x02' DF1SymbolMessageFrame
[simple uint 8 destinationAddress]
[simple uint 8 sourceAddress]
[simple DF1Command command]
[const uint 8 messageEnd 0x10]
[const uint 8 endTransaction 0x03]
[checksum uint 16 'crc' 'STATIC_CALL("org.apache.plc4x.java.df1.readwrite.utils.StaticHelper.crcCheck", destinationAddress, sourceAddress, command)']
]
['0x06' DF1SymbolMessageFrameACK
]
['0x15' DF1SymbolMessageFrameNAK
]
]
]
[discriminatedType DF1Command
[discriminator uint 8 commandCode]
[simple uint 8 status]
[simple uint 16 transactionCounter]
[typeSwitch 'commandCode'
['0x01' DF1UnprotectedReadRequest
[simple uint 16 address]
[simple uint 8 size]
]
['0x41' DF1UnprotectedReadResponse
[manualArray uint 8 'data' terminated 'STATIC_CALL("org.apache.plc4x.java.df1.readwrite.utils.StaticHelper.dataTerminate", io)' 'STATIC_CALL("org.apache.plc4x.java.df1.readwrite.utils.StaticHelper.readData", io)' 'STATIC_CALL("org.apache.plc4x.java.df1.readwrite.utils.StaticHelper.writeData", io, element)' 'STATIC_CALL("org.apache.plc4x.java.df1.readwrite.utils.StaticHelper.dataLength", data)']
]
]
]</pre>
</div>
</div>
<div class="paragraph">
<p>The basic object is the DF1Symbol, where the second byte is used to distinguish between the different message types using a typeSwitch.
In the case of a command message, the message frame contains the DF1Command to further differentiate between the command types.
Currently only the unprotected read and its response are implemented.</p>
</div>
</article>
</div>
</main>
</div>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<footer class="container-flex footer col-6" style="text-align:center;">
<div class="col"></div>
<div class="col-6">
Copyright &#169; 2017-2026 <a href="https://www.apache.org/">The Apache Software Foundation.</a> All rights reserved.<br/>
Apache PLC4X, PLC4X, Apache, the Apache feather logo, and the Apache PLC4X project logo are either registered
trademarks or trademarks of The Apache Software Foundation in the United States and other countries. All other marks
mentioned may be trademarks or registered trademarks of their respective owners.
<br/>
</div>
<div>Home screen image taken from <a
href="https://flic.kr/p/chEftd">Flickr</a>, "Tesla Robot Dance" by Steve Jurvetson, licensed
under <a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0 Generic</a>, image cropped
and blur effect added.
</div>
<div class="col"></div>
</footer>
<script id="site-script" src="../../../../../_/js/site.js" data-ui-root-path="../../../../../_"></script>
<script async src="../../../../../_/js/vendor/highlight.js"></script>
<script src="../../../../../_/js/vendor/lunr.js"></script>
<script src="../../../../../_/js/search-ui.js" id="search-ui-script" data-site-root-path="../../../../.." data-snippet-length="100" data-stylesheet="../../../../../_/css/search.css"></script>
<script async src="../../../../../search-index.js"></script>
</body>
</html>