<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to open file in simulation mode</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/85ca8308cc/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/85ca8308cc/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/85ca8308cc/</id><updated>2020-02-27T21:07:51.097000Z</updated><subtitle>Recent posts to open file in simulation mode</subtitle><entry><title>open file in simulation mode</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/85ca8308cc/?limit=25#9243" rel="alternate"/><published>2020-02-27T21:07:51.097000Z</published><updated>2020-02-27T21:07:51.097000Z</updated><author><name>ventas3</name><uri>https://forge.codesys.com/u/ventas3/</uri></author><id>https://forge.codesys.comcdeb6c6ef05183bf41d501ccf18ea60b3035aa1f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Mikhail Shvetsov hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
If i understood you correctly....&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Hello my friend. I've a question, i hope you can help me please, in advance apologize the inconvenience...&lt;br/&gt;
i try to connecting my &lt;span style="color: #0000FF;"&gt;PLC easyHMI MFD4&lt;/span&gt; to a sensor with a Ethernet interface but, i'm using &lt;span style="color: #0000FF;"&gt;syslibsocket library&lt;/span&gt;, not possible.. can you help me to do? first i connect my plc with a &lt;span style="color: #0040FF;"&gt;java application&lt;/span&gt; make for me, the program java it's fine. i can do connect, but i can not write or read data from PLC. &lt;span style="color: #FF0000;"&gt;if i can to do that, i can do it between PLC and Sensor&lt;/span&gt;... Thank you!.&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #FF0000;"&gt;Servidor&lt;/span&gt; means SERVER, &lt;span style="color: #FF0000;"&gt;CONECTAR&lt;/span&gt;: connect, &lt;span style="color: #FF0000;"&gt;esperando conexion&lt;/span&gt;: waiting for connection, &lt;span style="color: #FF0000;"&gt;conexion 1 recibida de:&lt;/span&gt; connection 1 recieve from&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Dibujo.JPG" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=213"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>open file in simulation mode</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/85ca8308cc/?limit=25#91e5" rel="alternate"/><published>2020-02-27T21:07:47.054000Z</published><updated>2020-02-27T21:07:47.054000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com65b2929021f053ba6652940620e1b289b64814be</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; Mikhail Shvetsov&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;ventas3 hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Muchisimas Gracias a todos!... Thank you very much for your help...!..&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Да всегда пожалуйста  - it means - You are always welcome!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>open file in simulation mode</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/85ca8308cc/?limit=25#f89d" rel="alternate"/><published>2020-02-27T21:07:45.612000Z</published><updated>2020-02-27T21:07:45.612000Z</updated><author><name>ventas3</name><uri>https://forge.codesys.com/u/ventas3/</uri></author><id>https://forge.codesys.com907c4f0207457bceba423b54598d077ccd09f8d4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;span&gt;[quote= It works well [/quote]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Muchisimas Gracias a todos!... Thank you very much for your help...! I discovered that the problem I had was when the file name. Should be done according to the specified path when you enter the command files..! ie &lt;span style="color: #0000FF;"&gt;OpenFile1: = SysFileOpen ('\ disk_sys \ project \ File1', 'r ')&lt;/span&gt;;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>open file in simulation mode</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/85ca8308cc/?limit=25#daed" rel="alternate"/><published>2020-02-27T21:07:41.618000Z</published><updated>2020-02-27T21:07:41.618000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.comd070c6514f5a4a272043084c7e19ec44628446f6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; Mikhail Shvetsov&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;ventas3 hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
excuse me but, if i use OPC server it's not easier? the example in russ is so good!. but, does not work...&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;All examples were checked out many times by a lot of peoples. Just believe me, i know it:) Theres a lot of peculiarities which isn't showed on figures but explained in text, and you probably miss them. But you can ask me about problem with it.I'll reply.&lt;/p&gt;
&lt;p&gt;i attached very simple project (special for you from Russia with love  ). This one is written for PLCWinNT. Start the program and change "Start" variable to TRUE.&lt;br/&gt;
It write the string WriteBuffer into file on drive "D" (you should fix it if you don't have drive D) and read it to string ReadBuffer.&lt;/p&gt;
&lt;p&gt;It works well &lt;/p&gt;
&lt;p&gt;&lt;a class="" href="https://forum.codesys.com//download/file.php?id=212" rel="nofollow"&gt;WriteReadFile.pro &lt;span&gt;&lt;span&gt;[32.43 KiB]&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>open file in simulation mode</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/85ca8308cc/?limit=25#8748" rel="alternate"/><published>2020-02-27T21:07:40.136000Z</published><updated>2020-02-27T21:07:40.136000Z</updated><author><name>Erik Böhm</name><uri>https://forge.codesys.com/u/erik-boehm/</uri></author><id>https://forge.codesys.com1cefddbeef0c6812ba8e352095fb511096e1652b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi&lt;br/&gt;
As usual, SysLibs do not work in Simulation mode.&lt;br/&gt;
There is no Hardware selected, so there are no SysLibs...&lt;/p&gt;
&lt;p&gt;Erik&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>open file in simulation mode</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/85ca8308cc/?limit=25#6196" rel="alternate"/><published>2020-02-27T21:07:36.076000Z</published><updated>2020-02-27T21:07:36.076000Z</updated><author><name>ventas3</name><uri>https://forge.codesys.com/u/ventas3/</uri></author><id>https://forge.codesys.com21fc578b58feceb3430c49f1f9dfa890d9d69b2f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks for your code. I wonder if the error is due to the way I'm stating the name of the file, because I am stating this: strFileName: STRING (255): = 'c: / data / mylog.txt', the results from strDataBuffer is 0 I think it can be because I'm in simulation mode and I understand that you can have conflicts, have you any idea how to see the results? The PLC I'm using is a MFD4-5-XRC-30. If only work connected with the PC or does will lack the MMC?&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;strFileName&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;STRING&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;):&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'c: / data / mylog.txt'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;the results are:&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Dibujok.JPG" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=211"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Dibujo.JPG" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=210"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>open file in simulation mode</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/85ca8308cc/?limit=25#1ea5" rel="alternate"/><published>2020-02-27T21:07:34.644000Z</published><updated>2020-02-27T21:07:34.644000Z</updated><author><name>Erik Böhm</name><uri>https://forge.codesys.com/u/erik-boehm/</uri></author><id>https://forge.codesys.com0911c2b847b38d863c9bf261206af43b5289ecfd</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Try this:&lt;/p&gt;
&lt;p&gt;FUNCTION_BLOCK WriteValueToFile_FB&lt;br/&gt;
VAR_INPUT&lt;br/&gt;
    strFileName:            STRING(255);&lt;br/&gt;
    strDataBuffer:          STRING(255);&lt;br/&gt;
END_VAR&lt;br/&gt;
VAR_OUTPUT&lt;br/&gt;
    bDone:      BOOL;&lt;br/&gt;
    bError:     BOOL;&lt;br/&gt;
    wErrorID:   WORD;&lt;br/&gt;
END_VAR&lt;br/&gt;
VAR&lt;br/&gt;
    dwBytesWritten: DWORD;&lt;br/&gt;
    dwFileWrite:        DWORD   := 0;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;hr/&gt;
&lt;p&gt;dwFileWrite := SysFileOpen(FileName:=strFileName, Mode:='a');&lt;/p&gt;
&lt;p&gt;IF dwFileWrite = 0 THEN (&lt;em&gt;error: file couldn't be opened &lt;/em&gt;)&lt;br/&gt;
    bError  := TRUE;&lt;br/&gt;
    wErrorID    := 1;&lt;br/&gt;
    RETURN;&lt;br/&gt;
END_IF&lt;/p&gt;
&lt;p&gt;dwBytesWritten  := SysFileWrite(File:=dwFileWrite, Buffer:=ADR(strDataBuffer), Size:=LEN(strDataBuffer));&lt;/p&gt;
&lt;p&gt;IF dwBytesWritten = LEN(strDataBuffer) THEN&lt;br/&gt;
    bDone   := TRUE;&lt;br/&gt;
    SysFileClose(dwFileWrite);&lt;br/&gt;
    dwFileWrite := 0;&lt;br/&gt;
ELSE&lt;br/&gt;
    bDone   := FALSE;&lt;br/&gt;
    SysFileClose(dwFileWrite);&lt;br/&gt;
    dwFileWrite := 0;&lt;br/&gt;
END_IF&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>open file in simulation mode</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/85ca8308cc/?limit=25#b90a" rel="alternate"/><published>2020-02-27T21:07:33.225000Z</published><updated>2020-02-27T21:07:33.225000Z</updated><author><name>ventas3</name><uri>https://forge.codesys.com/u/ventas3/</uri></author><id>https://forge.codesys.com546e14d6042402374d19b842c0a97ce70f42c902</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I really want to get the value from a global variable of codesys, then to safe that values into a .txt file; but i don't know if using OPC would be easier for that, that was my question about OPC. but, please if you can help me to make that, i will be thankful.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>open file in simulation mode</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/85ca8308cc/?limit=25#5960" rel="alternate"/><published>2020-02-27T21:07:28.749000Z</published><updated>2020-02-27T21:07:28.749000Z</updated><author><name>Erik Böhm</name><uri>https://forge.codesys.com/u/erik-boehm/</uri></author><id>https://forge.codesys.com2c3c6e423da4875fc2529e15dedb300c32c27c8e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;What do you want ?&lt;br/&gt;
Write into a .txt, or use OPC ?&lt;br/&gt;
Thats 2 different things...&lt;br/&gt;
Writing in a file is very easy.&lt;/p&gt;
&lt;p&gt;Erik&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>open file in simulation mode</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/85ca8308cc/?limit=25#df0a" rel="alternate"/><published>2020-02-27T21:07:26.784000Z</published><updated>2020-02-27T21:07:26.784000Z</updated><author><name>ventas3</name><uri>https://forge.codesys.com/u/ventas3/</uri></author><id>https://forge.codesys.com346c3d1883296925724b74080b157ad63b4f4939</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;excuse me but, if i use OPC server it's not easier? the example in russ is so good!. but, does not work...&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>