<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Execute executable program </title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/544c54370e/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Runtime/thread/544c54370e/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Runtime/thread/544c54370e/</id><updated>2020-08-17T16:23:30.555000Z</updated><subtitle>Recent posts to Execute executable program </subtitle><entry><title>Execute executable program </title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/544c54370e/?limit=25#a576" rel="alternate"/><published>2020-08-17T16:23:30.555000Z</published><updated>2020-08-17T16:23:30.555000Z</updated><author><name>elsabz</name><uri>https://forge.codesys.com/u/elsabz/</uri></author><id>https://forge.codesys.com060d604b5e4a78aa67bed8fd43267fb84c67d4e3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;yes it works, thanks.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Execute executable program </title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/544c54370e/?limit=25#6775" rel="alternate"/><published>2020-08-11T05:44:15.550000Z</published><updated>2020-08-11T05:44:15.550000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.com32bc90b001dfd044d496b15473971ebe4d1d18c9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;try to call without sudo..&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Execute executable program </title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/544c54370e/?limit=25#9650" rel="alternate"/><published>2020-08-09T10:12:32.026000Z</published><updated>2020-08-09T10:12:32.026000Z</updated><author><name>elsabz</name><uri>https://forge.codesys.com/u/elsabz/</uri></author><id>https://forge.codesys.com3398facee63359134ab2e62228a826e213d2ecdf</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;on raspberrypi 4 I would like to run a program written in C by launching it from the codesys runtime project.&lt;br/&gt;
The compiled program launched from the terminal works correctly.&lt;br/&gt;
I use the command:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;sudo&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;home&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;pi&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;Documents&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plain&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;shm&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;shm&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I add at the bottom in the file /etc/CODESYSControl.cfg and /etc/CODESYSControl_User.cfg&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[SysProcess]&lt;/span&gt;
&lt;span class="na"&gt;Command&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;AllowAll&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Then i program this code&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;PROGRAM&lt;/span&gt; &lt;span class="nv"&gt;SysCom&lt;/span&gt;
&lt;span class="nv"&gt;VAR&lt;/span&gt;
    &lt;span class="nv"&gt;command1&lt;/span&gt; : &lt;span class="nv"&gt;STRING&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sudo /home/pi/Documents/c-plain/shm/shm&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;stdout&lt;/span&gt; : &lt;span class="nv"&gt;STRING&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="c1"&gt;;    &lt;/span&gt;
    &lt;span class="nb"&gt;Result&lt;/span&gt; : &lt;span class="nv"&gt;RTS_IEC_RESULT&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;xExecuteSysP&lt;/span&gt;: &lt;span class="nv"&gt;BOOL&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;END_VAR&lt;/span&gt;

&lt;span class="k"&gt;IF&lt;/span&gt; &lt;span class="nv"&gt;xExecuteSysP&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
    &lt;span class="nv"&gt;SysProcess&lt;/span&gt;.&lt;span class="nv"&gt;SysProcessExecuteCommand2&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;pszCommand&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;command1&lt;/span&gt;, &lt;span class="nv"&gt;pszStdOut&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;stdout&lt;/span&gt;, &lt;span class="nv"&gt;udiStdOutLen&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;SIZEOF&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;stdout&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;,&lt;span class="nv"&gt;pResult&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;ADR&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Result&lt;/span&gt;&lt;span class="ss"&gt;))&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;xExecuteSysP&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;FALSE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_IF&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The SysCom program is called cyclically.&lt;br/&gt;
When it works in runtime, setting TRUE the&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;xExecuteSysP&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;var, nothing happens, the program is not executed.&lt;/p&gt;
&lt;p&gt;Why doesn't it work?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>