<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Struct containing BOOLs</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/ac42ac7559/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/ac42ac7559/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/ac42ac7559/</id><updated>2020-02-27T23:09:39.355000Z</updated><subtitle>Recent posts to Struct containing BOOLs</subtitle><entry><title>Struct containing BOOLs</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ac42ac7559/?limit=25#0fa9" rel="alternate"/><published>2020-02-27T23:09:39.355000Z</published><updated>2020-02-27T23:09:39.355000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com0f671b1386dd4b63d345fd96a06a8eddd08731e1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;no you can not use functions inside structures however you can use unpack on part of a struc&lt;/p&gt;
&lt;p&gt;and no you can not change a bool in a byte however you can change a bit inside a byte and test on it.&lt;br/&gt;
if bit5 of byte is true then bool5 is true&lt;br/&gt;
if bool5 then byte = byte or bit5 bit5 is a byte with bit5 set on so (0001 0000) =32&lt;br/&gt;
(make bit0 to bit7)&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Struct containing BOOLs</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ac42ac7559/?limit=25#f41a" rel="alternate"/><published>2020-02-27T23:09:37.753000Z</published><updated>2020-02-27T23:09:37.753000Z</updated><author><name>Sekhmet</name><uri>https://forge.codesys.com/u/sekhmet/</uri></author><id>https://forge.codesys.coma4e1eee61beeefa4f035b1acb642dc430645a5e6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;shooter hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
yes you can &lt;br/&gt;
use pack and unpack this will make a word of a lot of bits.&lt;br/&gt;
and a bool is 1 byte.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;yeah atm i'm using pack and unpack. &lt;br/&gt;
but as far as i understand it, i can't use those functions inside a struct to assign the values to specific elements of the struct. &lt;br/&gt;
if that is incorrect, please explain how. &lt;/p&gt;
&lt;p&gt;thanks in advance&lt;br/&gt;
Sek&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Struct containing BOOLs</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ac42ac7559/?limit=25#7c54" rel="alternate"/><published>2020-02-27T23:09:33.260000Z</published><updated>2020-02-27T23:09:33.260000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com80a5df97f703dd6491ec89a70d90eeec2839b654</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;yes you can &lt;br/&gt;
use pack and unpack this will make a word of a lot of bits.&lt;br/&gt;
and a bool is 1 byte.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Struct containing BOOLs</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ac42ac7559/?limit=25#70d8" rel="alternate"/><published>2020-02-27T23:09:31.643000Z</published><updated>2020-02-27T23:09:31.643000Z</updated><author><name>Sekhmet</name><uri>https://forge.codesys.com/u/sekhmet/</uri></author><id>https://forge.codesys.com95b18f13fbb6e3f3ad039ae305c136f785f6dcdb</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Sounds Logical but unfortunate &lt;br/&gt;
Is there any reasonable way to map a Word to a Struct 16 individual Bool-Variables besides the long way?&lt;br/&gt;
I'm not very familiar with the inner logic of Variable-space association. &lt;/p&gt;
&lt;p&gt;thanks in advance&lt;br/&gt;
Sek&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Struct containing BOOLs</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ac42ac7559/?limit=25#8241" rel="alternate"/><published>2020-02-27T23:09:27.154000Z</published><updated>2020-02-27T23:09:27.154000Z</updated><author><name>maauto</name><uri>https://forge.codesys.com/u/maauto/</uri></author><id>https://forge.codesys.comad3263e9f2036452abd0fff6d531b7ee1ec7a85b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;As far as I know a struct of 16 bools (or an array of 16 bools) does not get addresed as a word. Instead, each bool in the structure (or array) uses up a byte (if you have "Byte addressing". At least that's how it works on my target platform.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Struct containing BOOLs</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ac42ac7559/?limit=25#939e" rel="alternate"/><published>2020-02-27T23:09:25.561000Z</published><updated>2020-02-27T23:09:25.561000Z</updated><author><name>Sekhmet</name><uri>https://forge.codesys.com/u/sekhmet/</uri></author><id>https://forge.codesys.com4cfae29cb3d2a6110ff1159c167d3a62b5adb3c5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi&lt;br/&gt;
I'm quite new here so please excuse me if this sounds stupid or anything. &lt;br/&gt;
I've just yesterday come across the Struct-Type for working with input-data sent from my hardware via profibus. &lt;br/&gt;
The Struct-Type was once automatically added by some Script or something, not sure, it works really nice and generates me a struct with 6 bytes in it. &lt;br/&gt;
So i thought, thats nice i'm gonna convert myself a WORD im beeing sent from an other device to 16 BOOL because each BOOL signals something different. &lt;br/&gt;
so now i set this up like the working one but instead of the 6 byte-vars i put 16 bool vars there. &lt;br/&gt;
But when i Compiled and uploaded to my CPU the Data was really weird. It looked like the CPU tried to write the whole WORD into the first BOOL (Signaled by 16#23 or something). &lt;br/&gt;
My question now is: Is that some kind of Bug or did i just do something wrong?&lt;br/&gt;
I don't have the exact qc here right now, its on the working-pc and i'm at home but i'll post it tomorrow. &lt;/p&gt;
&lt;p&gt;thanks in advance&lt;br/&gt;
Sek&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>