<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Better Signal Mapping</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/ef090e261e/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/ef090e261e/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/ef090e261e/</id><updated>2021-02-23T23:04:09.282000Z</updated><subtitle>Recent posts to Better Signal Mapping</subtitle><entry><title>Better Signal Mapping</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/ef090e261e/?limit=25#70a0" rel="alternate"/><published>2021-02-23T23:04:09.282000Z</published><updated>2021-02-23T23:04:09.282000Z</updated><author><name>i-campbell</name><uri>https://forge.codesys.com/u/i-campbell/</uri></author><id>https://forge.codesys.comd91328bb29872c0b47285268eb402d47d1fc8833</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;As you have 4 distinct parameters, it will not be possible to map them to a BIT variable from the mapping dialog.&lt;br/&gt;
You could try &lt;br/&gt;
testBytes  AT %QB200  : Output_Union;&lt;br/&gt;
OR &lt;br/&gt;
testBytes AT %QB400 : Output_Union;&lt;br/&gt;
Depending on which addressing mode your PLC uses.&lt;/p&gt;
&lt;p&gt;You could also use Util.Pack() somewhere in your code&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Better Signal Mapping</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/ef090e261e/?limit=25#53c7" rel="alternate"/><published>2021-02-23T22:48:58.274000Z</published><updated>2021-02-23T22:48:58.274000Z</updated><author><name>mike-at-gms</name><uri>https://forge.codesys.com/u/mike-at-gms/</uri></author><id>https://forge.codesys.comc511fe0e86ef6b2a415a5f08f10345fa69648d75</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thank you &lt;a class="user-mention" href="/u/i-campbell/"&gt;@i-campbell&lt;/a&gt;. Using testBools[x] in the mapping does work.&lt;/p&gt;
&lt;p&gt;I am trying to pass these points along to a client over a network and I would like to just send a bunch of Bytes (without manually converting them). The BOOL type does not map nicely to Bytes. &lt;/p&gt;
&lt;p&gt;I would like to do something like:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;InputBytes&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ARRAY&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="n"&gt;OF&lt;/span&gt; &lt;span class="n"&gt;BYTE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;and then use 'InputBytes&lt;span&gt;[0]&lt;/span&gt;.2' in the mapping. However, this will not even compile.&lt;/p&gt;
&lt;p&gt;Using an array of BOOL makes the network sending messy.&lt;/p&gt;
&lt;p&gt;The benefit of the Union is that the value of the 8 BITS is exposed in through the BYTE object (aByte in the example). If I use BOOL in the Output_Byte structure, this relationship breaks.&lt;/p&gt;
&lt;p&gt;I will look at it more with your suggestion in mind and see if I am approaching this wrong.&lt;/p&gt;
&lt;p&gt;Thank you again.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Better Signal Mapping</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/ef090e261e/?limit=25#c871" rel="alternate"/><published>2021-02-23T22:09:32.226000Z</published><updated>2021-02-23T22:09:32.226000Z</updated><author><name>i-campbell</name><uri>https://forge.codesys.com/u/i-campbell/</uri></author><id>https://forge.codesys.comaa8e6b36f47af3a3af4482287910a1b8ba9788e6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Try &lt;/p&gt;
&lt;p&gt;testBools : ARRAY &lt;span&gt;[0..9]&lt;/span&gt; OF BOOL;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Better Signal Mapping</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/ef090e261e/?limit=25#7438" rel="alternate"/><published>2021-02-23T19:36:00.371000Z</published><updated>2021-02-23T19:36:00.371000Z</updated><author><name>mike-at-gms</name><uri>https://forge.codesys.com/u/mike-at-gms/</uri></author><id>https://forge.codesys.coma20c9e23fe3d531ce441bbb87305ac3538903a58</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am trying to cleanup some variable mapping. I have an I/O device that has its points defined as BIT. I would like to map these into an array of something but I cannot use an array of BIT. Mapping to an array allows me to access bits through a common FB so I only need to map the points once.&lt;br/&gt;
I have created a &lt;strong&gt;Union&lt;/strong&gt; based on a Forum response (&lt;a href="https://forge.codesys.com/forge/talk/Engineering/thread/9613d49992/"&gt;https://forge.codesys.com/forge/talk/Engineering/thread/9613d49992/&lt;/a&gt;) and it seems to do what I would like. However, when I map the bits to my device, I get a C0355 warning (A single bit cannot be referenced. A reference to the complete byte will be stored.). &lt;/p&gt;
&lt;p&gt;What does this warning mean and is there a better way to map this?&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;
&lt;h6 id="my-code"&gt;My code:&lt;/h6&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;TYPE&lt;/span&gt; &lt;span class="n"&gt;Output_Byte&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="n"&gt;STRUCT&lt;/span&gt;
   &lt;span class="n"&gt;Bit0&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;BIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="n"&gt;Bit1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;BIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="n"&gt;Bit2&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;BIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="n"&gt;Bit3&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;BIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="n"&gt;Bit4&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;BIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="n"&gt;Bit5&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;BIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="n"&gt;Bit6&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;BIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="n"&gt;Bit7&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;BIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_STRUCT&lt;/span&gt;
&lt;span class="n"&gt;END_TYPE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;TYPE&lt;/span&gt; &lt;span class="n"&gt;Output_Union&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="k"&gt;UNION&lt;/span&gt;
   &lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;Note&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;I&lt;/span&gt; &lt;span class="n"&gt;added&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="nb"&gt;array&lt;/span&gt; &lt;span class="n"&gt;here&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;test&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="n"&gt;I&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;same&lt;/span&gt; &lt;span class="n"&gt;C355&lt;/span&gt; &lt;span class="n"&gt;warning&lt;/span&gt; &lt;span class="n"&gt;even&lt;/span&gt; &lt;span class="k"&gt;without&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
   &lt;span class="n"&gt;aByte&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;ARRAY&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;OF&lt;/span&gt; &lt;span class="n"&gt;BYTE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="n"&gt;Bytes&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;ARRAY&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;OF&lt;/span&gt; &lt;span class="n"&gt;Output_Byte&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_UNION&lt;/span&gt;
&lt;span class="n"&gt;END_TYPE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;h6 id="usage-in-global"&gt;Usage in Global:&lt;/h6&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;   &lt;span class="n"&gt;testBytes&lt;/span&gt;    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Output_Union&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;h6 id="usage-in-my-device-map"&gt;Usage in my device map:&lt;/h6&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;Application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;Global&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;testBytes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Bytes&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;Bit2&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;img src="./attachment/ModuleMap.png"/&gt;&lt;br/&gt;
(Why does my image not show?)&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>