<?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/Engineering/thread/a8f25e3194/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a8f25e3194/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/a8f25e3194/</id><updated>2020-02-27T14:40:23.095000Z</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/Engineering/thread/a8f25e3194/?limit=25#fee5" rel="alternate"/><published>2020-02-27T14:40:23.095000Z</published><updated>2020-02-27T14:40:23.095000Z</updated><author><name>ventas3</name><uri>https://forge.codesys.com/u/ventas3/</uri></author><id>https://forge.codesys.comdd36e04dc17391c4959c31e7892c8e388773d85f</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=223"/&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/Engineering/thread/a8f25e3194/?limit=25#9548" rel="alternate"/><published>2020-02-27T14:40:22.589000Z</published><updated>2020-02-27T14:40:22.589000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com2c9015d87f3243a37267e5beb93ce294c72450ec</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/Engineering/thread/a8f25e3194/?limit=25#f86d" rel="alternate"/><published>2020-02-27T14:40:21.185000Z</published><updated>2020-02-27T14:40:21.185000Z</updated><author><name>ventas3</name><uri>https://forge.codesys.com/u/ventas3/</uri></author><id>https://forge.codesys.com6bae5308cf7578b0d24da786650f1ab3db343fa1</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/Engineering/thread/a8f25e3194/?limit=25#8d56" rel="alternate"/><published>2020-02-27T14:40:20.682000Z</published><updated>2020-02-27T14:40:20.682000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com0c4ff26816659d601be2fc41746ca27e42c0c9b0</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=222" 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/Engineering/thread/a8f25e3194/?limit=25#2c5c" rel="alternate"/><published>2020-02-27T14:40:20.190000Z</published><updated>2020-02-27T14:40:20.190000Z</updated><author><name>Erik Böhm</name><uri>https://forge.codesys.com/u/erik-boehm/</uri></author><id>https://forge.codesys.com7f244c73dd8cec0c2650cc8e82bcd0ca48285fef</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/Engineering/thread/a8f25e3194/?limit=25#de99" rel="alternate"/><published>2020-02-27T14:40:18.759000Z</published><updated>2020-02-27T14:40:18.759000Z</updated><author><name>ventas3</name><uri>https://forge.codesys.com/u/ventas3/</uri></author><id>https://forge.codesys.comafae9a5d45fba04178799ecb25d88a9be6d5a7c3</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=221"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Dibujo.JPG" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=220"/&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/Engineering/thread/a8f25e3194/?limit=25#ca1e" rel="alternate"/><published>2020-02-27T14:40:18.212000Z</published><updated>2020-02-27T14:40:18.212000Z</updated><author><name>Erik Böhm</name><uri>https://forge.codesys.com/u/erik-boehm/</uri></author><id>https://forge.codesys.com50ef6f24fab5de2f9df5ae442d480dd275d30616</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/Engineering/thread/a8f25e3194/?limit=25#f2bf" rel="alternate"/><published>2020-02-27T14:40:17.635000Z</published><updated>2020-02-27T14:40:17.635000Z</updated><author><name>ventas3</name><uri>https://forge.codesys.com/u/ventas3/</uri></author><id>https://forge.codesys.comcdc1f103c257edc3a28edf72ce6766241c5d1e94</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/Engineering/thread/a8f25e3194/?limit=25#b993" rel="alternate"/><published>2020-02-27T14:40:16.037000Z</published><updated>2020-02-27T14:40:16.037000Z</updated><author><name>Erik Böhm</name><uri>https://forge.codesys.com/u/erik-boehm/</uri></author><id>https://forge.codesys.comd6f9133777e00f92527e808f59b993b73c25528b</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/Engineering/thread/a8f25e3194/?limit=25#61a7" rel="alternate"/><published>2020-02-27T14:40:15.537000Z</published><updated>2020-02-27T14:40:15.537000Z</updated><author><name>ventas3</name><uri>https://forge.codesys.com/u/ventas3/</uri></author><id>https://forge.codesys.com7ba3ba29d4ac2ef65673e9067bf8e850b8ebfeb1</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>