<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to how to map a bit structure to %MX?</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/7403cf40e4/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/7403cf40e4/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/7403cf40e4/</id><updated>2020-02-27T22:31:51.858000Z</updated><subtitle>Recent posts to how to map a bit structure to %MX?</subtitle><entry><title>how to map a bit structure to %MX?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/7403cf40e4/?limit=25#8cdb" rel="alternate"/><published>2020-02-27T22:31:51.858000Z</published><updated>2020-02-27T22:31:51.858000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com391307d9ad0764d81557f5f752740f3093be3870</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;your way is good, as bits are stored as bytes, so you can not put them in a bitaddress.&lt;br/&gt;
however you can pack bits into bytes and unpack them again.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>how to map a bit structure to %MX?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/7403cf40e4/?limit=25#e465" rel="alternate"/><published>2020-02-27T22:31:47.478000Z</published><updated>2020-02-27T22:31:47.478000Z</updated><author><name>hki75</name><uri>https://forge.codesys.com/u/hki75/</uri></author><id>https://forge.codesys.com4872ca2107cee447cf251f16424e1b9c6174b100</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I need to use modbus addresing..&lt;br/&gt;
I think I found the solution:&lt;/p&gt;
&lt;p&gt;I created a function that split an INPUT var into the single bit of the structure as following:&lt;/p&gt;
&lt;p&gt;FUNCTION FuntionName : UDT&lt;br/&gt;
VAR_IN_OUT&lt;br/&gt;
    IN : DWORD;&lt;br/&gt;
END_VAR&lt;br/&gt;
FuntionName .0:=IN.0;&lt;br/&gt;
FuntionName .1:=IN.1;&lt;/p&gt;
&lt;p&gt;and then when I call FUN in PRG I declare as :&lt;/p&gt;
&lt;p&gt;MOTORCOMMAND:=FuntionName(%MD80);&lt;/p&gt;
&lt;p&gt;in this way I have:&lt;br/&gt;
%MX160.0=MOTORCOMMAND.0&lt;br/&gt;
%MX160.1=MOTORCOMMAND.1&lt;br/&gt;
%MX160.2=MOTORCOMMAND.2&lt;br/&gt;
........&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>how to map a bit structure to %MX?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/7403cf40e4/?limit=25#073c" rel="alternate"/><published>2020-02-27T22:31:45.918000Z</published><updated>2020-02-27T22:31:45.918000Z</updated><author><name>carcrosser</name><uri>https://forge.codesys.com/u/carcrosser/</uri></author><id>https://forge.codesys.com060cb8ea47a86bf035e31a3e4c9816ae796e70c1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;do you have your visulisation on the PLC or are you using network variables (MODBUS TCP/IP for example)&lt;br/&gt;
if you use the visuals on the PLC you can simply modify them in the visualisation screen by selecting the correct variable. there is no need for this to store it on a physical hardware address.&lt;/p&gt;
&lt;p&gt;if you use the mod bus, then you require this option, however I'm not sure on the ability to write this variables from the network.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>how to map a bit structure to %MX?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/7403cf40e4/?limit=25#e0f5" rel="alternate"/><published>2020-02-27T22:31:44.342000Z</published><updated>2020-02-27T22:31:44.342000Z</updated><author><name>hki75</name><uri>https://forge.codesys.com/u/hki75/</uri></author><id>https://forge.codesys.coma23db1452fe785ef72fac2e531f83d659a8e65a3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;thanks carcrosser. &lt;br/&gt;
I've already tried as you suggest, but in that way there is not correspondence bit-bit between %MX and bit of structures..Moreover going online I receive an invalid state for structured variable&lt;/p&gt;
&lt;p&gt;I mean: from HMI I need to send bit command to PLC&lt;/p&gt;
&lt;p&gt;HMI Command 1-&amp;gt; MX0.0    --&amp;gt; Structure bit 0&lt;br/&gt;
HMI Command 1-&amp;gt; MX0.1    --&amp;gt; Structure bit 1&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>how to map a bit structure to %MX?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/7403cf40e4/?limit=25#5a5b" rel="alternate"/><published>2020-02-27T22:31:39.976000Z</published><updated>2020-02-27T22:31:39.976000Z</updated><author><name>carcrosser</name><uri>https://forge.codesys.com/u/carcrosser/</uri></author><id>https://forge.codesys.com9e38ad9646e8d4bc4f727f41f32a4ae663ffdaef</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;MX is only boolean as far as I'm concerned. use MW instead&lt;/p&gt;
&lt;p&gt;so AT %MX0.0 &lt;br/&gt;
becomes&lt;br/&gt;
    AT %MW0&lt;/p&gt;
&lt;p&gt;bear in mind that&lt;br/&gt;
MX0.0 up to MX0.15&lt;br/&gt;
combined will fill word 0 as well as MW0&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>how to map a bit structure to %MX?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/7403cf40e4/?limit=25#d890" rel="alternate"/><published>2020-02-27T22:31:38.398000Z</published><updated>2020-02-27T22:31:38.398000Z</updated><author><name>hki75</name><uri>https://forge.codesys.com/u/hki75/</uri></author><id>https://forge.codesys.comfa003c4e9e0029aa865b3bac00e0e728d90da5e8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi all,&lt;br/&gt;
I need to map a bit-structure into addresses bit area as %MX.&lt;br/&gt;
I cannot find a way to do it.. &lt;/p&gt;
&lt;p&gt;this is the declaration in "Global Variable"&lt;/p&gt;
&lt;p&gt;AT %MX0.0 : ;&lt;/p&gt;
&lt;p&gt;when compiling always return "only BOOL variable allowed on bit addresses"&lt;/p&gt;
&lt;p&gt;how to solve it? I need to map UDT to physical addr to receive modbus command from HMI..define bit by bit will result too boring and will generate too many variable..&lt;/p&gt;
&lt;p&gt;Every suggestion is appreciated&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>