<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Modbus configuration</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2037f2ed1a/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2037f2ed1a/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/2037f2ed1a/</id><updated>2021-07-06T13:26:13.290000Z</updated><subtitle>Recent posts to Modbus configuration</subtitle><entry><title>Modbus configuration</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2037f2ed1a/?limit=25#5f16" rel="alternate"/><published>2021-07-06T13:26:13.290000Z</published><updated>2021-07-06T13:26:13.290000Z</updated><author><name>joanm</name><uri>https://forge.codesys.com/u/joanm/</uri></author><id>https://forge.codesys.comca36d7b5ab97ef82c2652118b348327a1f18e722</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;OK, solved... in TWinCAT you MUST put the variable you want to connect to any IO channel as %I&lt;em&gt; / %Q&lt;/em&gt; or similar... it looks like in Codesys you MUST NOT.&lt;/p&gt;
&lt;p&gt;After reading the message slowly (good for me) I've been able to solve it and now I can directly assign the structure to the beginning of the Modbus channel.&lt;/p&gt;
&lt;p&gt;^^¡&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modbus configuration</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2037f2ed1a/?limit=25#0abb" rel="alternate"/><published>2021-06-30T11:34:06.639000Z</published><updated>2021-06-30T11:34:06.639000Z</updated><author><name>joanm</name><uri>https://forge.codesys.com/u/joanm/</uri></author><id>https://forge.codesys.com9bb5e2cdc7d2b7497045efb75f6d786d5eadba46</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello all,&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;INTRODUCTION&lt;/strong&gt;&lt;br/&gt;
Started using Codesys this week, been using TWinCAT for years though.&lt;/p&gt;
&lt;p&gt;Programming is not an issue given my background, but the configuration part changes a little and I have a doubt about the &lt;em&gt;ModbusTCPSlave I/O Mapping&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;I've got some information from the manufacturer of the device I'm programming and the device will send me 1 BYTEs, 1 WORDs, 1 BYTEs and 15 REALs (64 bytes or 32 words in total).&lt;/p&gt;
&lt;p&gt;Those variables are inside a structure:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;TYPE ST_MODBUS_DATA_FROM_DEVICE_1 :&lt;/span&gt;
&lt;span class="err"&gt;STRUCT&lt;/span&gt;
&lt;span class="err"&gt;    B01 : BYTE := 0;&lt;/span&gt;
&lt;span class="err"&gt;    w01 : WORD := 0;&lt;/span&gt;
&lt;span class="err"&gt;    B02 : BYTE := 0;&lt;/span&gt;
&lt;span class="err"&gt;    r01 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;    r02 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;    r03 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;    r04 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;    r05 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;    r06 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;    r07 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;    r08 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;    r09 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;    r10 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;    r11 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;    r12 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;    r13 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;    r14 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;    r15 : REAL := 0.0;&lt;/span&gt;
&lt;span class="err"&gt;END_STRUCT&lt;/span&gt;
&lt;span class="err"&gt;END_TYPE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I've added 1 channel, with an offset of 16#7531 and a length of 32.&lt;/p&gt;
&lt;p&gt;This has created an array&lt;span&gt;[0..31]&lt;/span&gt; of WORD in the ModbusTCPSlave I/O Mapping.&lt;/p&gt;
&lt;p&gt;Now, I want to link/map the variables into the channel, but I have BYTEs and REALs not WORDs.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;QUESTION&lt;/strong&gt;&lt;br/&gt;
How can I map my structure to the Modbus channel?&lt;/p&gt;
&lt;p&gt;Any hint (related to this ;) ) will be appreciated.&lt;/p&gt;
&lt;p&gt;Thank you very much for your time and help.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>