<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Assign Initial Value of Array of Byte</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/11beb8b127/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/11beb8b127/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/11beb8b127/</id><updated>2020-02-27T23:01:51.802000Z</updated><subtitle>Recent posts to Assign Initial Value of Array of Byte</subtitle><entry><title>Assign Initial Value of Array of Byte</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/11beb8b127/?limit=25#8f21" rel="alternate"/><published>2020-02-27T23:01:51.802000Z</published><updated>2020-02-27T23:01:51.802000Z</updated><author><name>Comingback4u</name><uri>https://forge.codesys.com/u/comingback4u/</uri></author><id>https://forge.codesys.com0832e5e032103b96a04ef348f597460e15edf547</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Have you tried:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nt"&gt;RX65265&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;ARRAY&lt;/span&gt; &lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="nx"&gt;..8&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt; &lt;span class="nt"&gt;OF&lt;/span&gt; &lt;span class="nt"&gt;BYTE&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="vi"&gt;#11111111&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Not sure how the space is handled between the "8 (" so I removed it.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Ultimately this should work also:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nt"&gt;RX65265&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;ARRAY&lt;/span&gt; &lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="nx"&gt;..8&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt; &lt;span class="nt"&gt;OF&lt;/span&gt; &lt;span class="nt"&gt;BYTE&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="vi"&gt;#D6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="nx"&gt;F&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="vi"&gt;#FF&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>Assign Initial Value of Array of Byte</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/11beb8b127/?limit=25#c799" rel="alternate"/><published>2020-02-27T23:01:50.172000Z</published><updated>2020-02-27T23:01:50.172000Z</updated><author><name>pmcmahon</name><uri>https://forge.codesys.com/u/pmcmahon/</uri></author><id>https://forge.codesys.comb333bb4e5c9ad782e1c69807fb291fb52314f4a3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;CoDeSys v2.3 on an IFM CR0403 basic controller&lt;/p&gt;
&lt;p&gt;Still very new to codesys so bear with me. I'm trying to assign an initial value to an array of bytes. I've tried a few things but i'm clearly missing something. Ultimately, i want to bring in the 8 byte data field of a CAN message and apply a bit mask with a second array to isolate the information i'm looking for. Whenever I try to assign the initial value of the array i get an error upon building that says "Erroneous initial value". I've tried typing out the individual bits, assigning in hex values using 16#FF, and just the decimal translation of the binary or hex value i need. Nothing works. &lt;/p&gt;
&lt;p&gt;Help please!&lt;br/&gt;
Pat&lt;/p&gt;
&lt;p&gt;VAR&lt;br/&gt;
    RX65265: ARRAY &lt;span&gt;[1..8]&lt;/span&gt; OF BYTE := &lt;span&gt;[8 (11111111)]&lt;/span&gt;;&lt;br/&gt;
    MASK: ARRAY &lt;span&gt;[1..8]&lt;/span&gt; OF BYTE;&lt;br/&gt;
    PBHEX: ARRAY &lt;span&gt;[1..8]&lt;/span&gt; OF BYTE;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;hr/&gt;
&lt;p&gt;(&lt;em&gt; RX65265 := &lt;span&gt;&lt;span&gt;[16#D6, 16#5F, 6 (16#FF)]&lt;/span&gt;&lt;/span&gt;; &lt;/em&gt;)&lt;br/&gt;
(&lt;em&gt; MASK := &lt;span&gt;&lt;span&gt;[16#0C, 7 (16#FF)]&lt;/span&gt;&lt;/span&gt;; &lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;PBHEX := RX65265 AND MASK&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>