<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to FB array initialization </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/76fb3a8eda/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/76fb3a8eda/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/76fb3a8eda/</id><updated>2020-04-04T18:57:22.990000Z</updated><subtitle>Recent posts to FB array initialization </subtitle><entry><title>FB array initialization </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/76fb3a8eda/?limit=25#7d68" rel="alternate"/><published>2020-04-04T18:57:22.990000Z</published><updated>2020-04-04T18:57:22.990000Z</updated><author><name>i-campbell</name><uri>https://forge.codesys.com/u/i-campbell/</uri></author><id>https://forge.codesys.comc88615672a6bc890c7d0dc2cfd2b847b99f084bd</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Works for me&lt;br/&gt;
I even deleted the return type BOOL for the function, and changed its capitalization like you did.  Maybe you're on an older version? or a safety PLC? maybe you put the FB_Init not in the SupportHandler but in the calling FB? Maybe you have SupportHandler shadowed? Maybe on a different controller to Control Win, it doesn't like when you capitalize FB_Init differently, or don't use the return type BOOL?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>FB array initialization </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/76fb3a8eda/?limit=25#d3f3/36f1/cb07" rel="alternate"/><published>2020-04-04T16:35:33.509000Z</published><updated>2020-04-04T16:35:33.509000Z</updated><author><name>maoravni</name><uri>https://forge.codesys.com/u/maoravni/</uri></author><id>https://forge.codesys.com1ffdaf135aac676df3e1845ded81a423c66c41e9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;No. It's a variant on one of the options I described above that doesn't compile.&lt;/p&gt;
&lt;p&gt;For some reason the compiler tries to push INTs into the array and fails on compilation.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>FB array initialization </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/76fb3a8eda/?limit=25#d3f3/36f1" rel="alternate"/><published>2020-04-04T15:35:30.441000Z</published><updated>2020-04-04T15:35:30.441000Z</updated><author><name>alejho</name><uri>https://forge.codesys.com/u/alejho/</uri></author><id>https://forge.codesys.com98f999d9062b1e9b1a50c6f0b854a1ad76785082</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I didn't make a test but try to take a look at the last post of this discussion:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://forge.codesys.com/forge/talk/Engineering/thread/dbf5a245f1/"&gt;https://forge.codesys.com/forge/talk/Engineering/thread/dbf5a245f1/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;does it work for you?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>FB array initialization </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/76fb3a8eda/?limit=25#d3f3" rel="alternate"/><published>2020-04-03T15:00:24.632000Z</published><updated>2020-04-03T15:00:24.632000Z</updated><author><name>maoravni</name><uri>https://forge.codesys.com/u/maoravni/</uri></author><id>https://forge.codesys.com9ffad2d630daeb65a56b268d18de0b82de6a3712</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Yes. It's my own Function Block.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>FB array initialization </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/76fb3a8eda/?limit=25#7973" rel="alternate"/><published>2020-04-03T09:30:15.234000Z</published><updated>2020-04-03T09:30:15.234000Z</updated><author><name>alejho</name><uri>https://forge.codesys.com/u/alejho/</uri></author><id>https://forge.codesys.com803c8c89f229d8b5c6095c509a908677ea02ba98</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;What kind of data is &lt;em&gt;SupportHandler&lt;/em&gt;?&lt;br/&gt;
It is a UDT?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>FB array initialization </title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/76fb3a8eda/?limit=25#1116" rel="alternate"/><published>2020-04-02T10:17:18.914000Z</published><updated>2020-04-02T10:17:18.914000Z</updated><author><name>maoravni</name><uri>https://forge.codesys.com/u/maoravni/</uri></author><id>https://forge.codesys.coma711c48698c919567ec703fa9b770fae853ab1f4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;searching the forums didn't reveal any helpful advice.&lt;/p&gt;
&lt;p&gt;I have a FB that is initialized through FB_init. It requires an additional parameter.&lt;/p&gt;
&lt;p&gt;METHOD FB_init&lt;br/&gt;
VAR_INPUT&lt;br/&gt;
    bInitRetains : BOOL; // if TRUE, the retain variables are initialized (warm start / cold start)&lt;br/&gt;
    bInCopyCode : BOOL;  // if TRUE, the instance afterwards gets moved into the copy code (online change)&lt;br/&gt;
    supportId : BYTE;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;p&gt;I have an array of these:&lt;br/&gt;
SupportHandlerArray:ARRAY&lt;span&gt;[1..2]&lt;/span&gt; OF  SupportHandler;&lt;/p&gt;
&lt;p&gt;I can't successfully initialize all members of the array. &lt;/p&gt;
&lt;p&gt;This works:&lt;br/&gt;
    S1 : SupportHandler(1);&lt;br/&gt;
    SupportHandlerArray:ARRAY&lt;span&gt;[1..2]&lt;/span&gt; OF  SupportHandler(0) := &lt;span&gt;[S1]&lt;/span&gt;;&lt;/p&gt;
&lt;p&gt;This initializes all members to the same value:&lt;br/&gt;
    SupportHandlerArray:ARRAY&lt;span&gt;[1..2]&lt;/span&gt; OF  SupportHandler(0);&lt;/p&gt;
&lt;p&gt;These doesn't compile:&lt;br/&gt;
    SupportHandlerArray:ARRAY&lt;span&gt;[1..2]&lt;/span&gt; OF  SupportHandler := &lt;span&gt;[1, 2]&lt;/span&gt;;&lt;br/&gt;
    SupportHandlerArray:ARRAY&lt;span&gt;[1..2]&lt;/span&gt; OF  SupportHandler := &lt;span&gt;[(1), (2)]&lt;/span&gt;;&lt;br/&gt;
    SupportHandlerArray:ARRAY&lt;span&gt;[1..2]&lt;/span&gt; OF  SupportHandler := &lt;span&gt;[(supportId:=1), (supportId:=2)]&lt;/span&gt;;&lt;br/&gt;
    SupportHandlerArray:ARRAY&lt;span&gt;[1..2]&lt;/span&gt; OF  SupportHandler&lt;span&gt;[(supportId:=1), (supportId:=2)]&lt;/span&gt;;&lt;/p&gt;
&lt;p&gt;The compilation errors range from syntax errors (for the last line)&lt;br/&gt;
&lt;span&gt;[ERROR]&lt;/span&gt;         LNDP-RTE-IPC: IPC_Handler(Line 12 (Decl)): C0006:  ';, := or (' expected instead of '&lt;span&gt;['&lt;br/&gt;
&lt;span&gt;&lt;span&gt;[ERROR]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;         LNDP-RTE-IPC: IPC_Handler(Line 12 (Decl)): C0138:  No matching FB_init method found for instantiation of SupportHandler&lt;/p&gt;
&lt;p&gt;To:&lt;br/&gt;
&lt;span&gt;[ERROR]&lt;/span&gt;         LNDP-RTE-IPC: IPC_Handler(Line 12 (Decl)): C0138:  No matching FB_init method found for instantiation of SupportHandler&lt;br/&gt;
&lt;span&gt;[ERROR]&lt;/span&gt;         LNDP-RTE-IPC: IPC_Handler(Line 12 (Decl)): C0046:  Identifier 'supportId' not defined&lt;br/&gt;
&lt;span&gt;[ERROR]&lt;/span&gt;         LNDP-RTE-IPC: IPC_Handler(Line 12 (Decl)): C0018:  'supportId' is no valid assignment target&lt;br/&gt;
&lt;span&gt;[ERROR]&lt;/span&gt;         LNDP-RTE-IPC: IPC_Handler(Line 12 (Decl)): C0046:  Identifier 'supportId' not defined&lt;br/&gt;
&lt;span&gt;[ERROR]&lt;/span&gt;         LNDP-RTE-IPC: IPC_Handler(Line 12 (Decl)): C0018:  'supportId' is no valid assignment target&lt;/p&gt;
&lt;p&gt;What am I missing?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>