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

16 декабря 2022 964 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
    Автор admin (29.06.2026)
    Tanesha, thank you, we are working)
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Tanesha (09.03.2026)
    Keep on working, great job!
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Leatha (08.03.2026)
    certainly like your web site however you need to t...
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Amie (06.03.2026)
    I couldn't resist commenting. Well written!
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Susanna (04.03.2026)
    Великолепное игровая платформа, продолжайте в том ...
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Benito (11.02.2026)
    Greate post. Keep writing such kind of info on you...
    library initialization failed - unable to allocate file descriptor table - out of memory
    Автор Noreen (11.02.2026)
    Just want to say your article is as amazing. The c...
    Что такое сны ?
    Автор admin (12.01.2026)
    stranger, Зато никогда не поздно)
    Рад, если у...
    Что такое сны ?
    Автор stranger (27.04.2025)
    Удивительная, просто удивительная статья!!!
    П...
    Обновление NetBSD до STABLE
    Автор www3 (14.06.2024)
    Много кто пользуется, но народ не очень словоохотл...
     Популярные
       
    Календарь
    « Июль »
    Пн Вт Ср Чт Пт Сб Вс
    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
    Яндекс.Метрика