Menu

Create Dynamic Tags

Help
2021-05-31
2021-06-08
  • Stanislav Popelka

    Hello Fabio

    I have one question. The system which should communicate with my app has variable size, thus the number of registers that need to be read is variable. I tried to create the tags dynamically like that:

    procedure TForm1.Button2Click(Sender: TObject);
    var
    Cell_V_tag: array of TPLCBlockElement;
    begin
    if SaveDialog1.Execute then
    begin
    DataLogFileName:=SaveDialog1.Filename;
    logging_en:=true;
    label25.caption:=DataLogFileName;
    LogFile_Create_Header(SaveDialog1.Filename);
    SetLength(Cell_V_tag,round(Form1.Config_Block_BRD_num_PortA.Value+Form1.Config_Block_BRD_num_PortB.Value)*23);
    Cell_V_tag[0].Create(self);
    // Cell_V_tag[1].Create(self);

    end;

    end;

    unfortunately I always get SIGSEGV error. Can you help me please to solve this problem?

    Thank you.

     
  • Fabio Luis Girardi

    You can create Dynamic tags at runtime. you have to to

    block.Size:=NewSize;
    for i:=0 to Block.Size-1 do begin
    BlockElement:=TPLCBlockElement.Create(block);
    BlockElement.Index:=i;
    BlockElement.PLCBlock:=Block;
    end;

    Please take care if you are using Modbus, because on this protocol, block has a restriction of 125 holding registers (words)

    Please join to Telegram group to get more fast help.

    https://t.me/pascalscada

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.