выполнение внешней команды в Codesys

16 декабря 2022 664 admin

Выполнение внешней команды в Codesys


В codesys можно выполнить внешние команды и скрипты. Например, скрипты на python, или на shell в Linux.
PROGRAM PLC_PRG
VAR
bTest : BOOL;
testTrigger : Standard.R_TRIG;
sCommand : STRING;
refCommand : REFERENCE TO STRING;
sOutput : STRING;
refOutput : REFERENCE TO STRING;
result : POINTER TO SysProcess.SysTypes.RTS_IEC_RESULT; ---------- Странно...
END_VAR

testTrigger(CLK:= bTest, Q=> );
sCommand:= 'echo Hello, Owen!';
refCommand REF= sCommand;
refOutput REF= sOutput;
IF testTrigger.Q THEN
SysProcessExecuteCommand2(pszCommand:= refCommand, pszStdOut:= refOutput, udiStdOutLen:= SIZEOF(sOutput), pResult:= ADR(result));
bTest:= FALSE;
END_IF

Источник: https://owen.ru/forum/showthread.php?t=20145&page=33
  • 0

Другие новости по теме:

Другие новости по теме:

    Добавление комментария

    Имя:
    Пароль:
    Email:
    Код:
    captcha
    Введите код:

    Последнии комментарии
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Nilda (17.12.2025)
    Nice blog here! Also your website loads up very fa...
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Kali (17.12.2025)
    I think the admin of this website is truly working...
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Shantae (17.12.2025)
    Great article, exactly what I wanted to find.

    my we...
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Bret (17.12.2025)
    Hello! This post could not be written any better!
    R...
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Martina (17.12.2025)
    It's awesome to go to see this site and reading th...
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Wilford (16.12.2025)
    This is a really good tip especially to those new ...
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Caitlyn (16.12.2025)
    Thanks for one's marvelous posting! I genuinely en...
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Jerry (15.12.2025)
    Yes! Finally something about You.

    Here is my websit...
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Tesha (15.12.2025)
    Asking questions are really good thing if you are ...
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор George (15.12.2025)
    Having read this I thought it was really informati...
     Популярные
       
    Календарь
    « Декабрь »
    Пн Вт Ср Чт Пт Сб Вс
    1 2 3 4 5 6 7
    8 9 10 11 12 13 14
    15 16 17 18 19 20 21
    22 23 24 25 26 27 28
    29 30 31
    Облако тегов
    Яндекс.Метрика