<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to RS232 Serial communication problems</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5cabc63909/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5cabc63909/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/5cabc63909/</id><updated>2020-02-27T14:08:38.268000Z</updated><subtitle>Recent posts to RS232 Serial communication problems</subtitle><entry><title>RS232 Serial communication problems</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5cabc63909/?limit=25#8d15" rel="alternate"/><published>2020-02-27T14:08:38.268000Z</published><updated>2020-02-27T14:08:38.268000Z</updated><author><name>timvh</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.com5379d7762868e7c7af9039dc0b6c8299c5beac57</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;You call comw1 only with execute := true.&lt;br/&gt;
This is the trigger to start.&lt;br/&gt;
To trigger it again, call the FB with execute := false at least one time in between.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>RS232 Serial communication problems</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5cabc63909/?limit=25#3f0d" rel="alternate"/><published>2020-02-27T14:08:37.888000Z</published><updated>2020-02-27T14:08:37.888000Z</updated><author><name>runar@samey.is</name><uri>https://forge.codesys.com/u/runar-samey-is/</uri></author><id>https://forge.codesys.comde700ce14c9e7eeb1bf0c96191fcc43091fc840b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I have tried it with and without handshake. I have also tried it without closing the port between sending messages. Here is the code I am using.&lt;/p&gt;
&lt;p&gt;IF xStartTest THEN&lt;/p&gt;
&lt;p&gt;//The parameters are set for the COM Port&lt;br/&gt;
aCom1Params&lt;span&gt;[1]&lt;/span&gt;.udiParameterId := COM.CAA_Parameter_Constants.udiPort;&lt;br/&gt;
aCom1Params&lt;span&gt;[1]&lt;/span&gt;.udiValue := 1; // the correct Port should be adapted&lt;br/&gt;
aCom1Params&lt;span&gt;[2]&lt;/span&gt;.udiParameterId := COM.CAA_Parameter_Constants.udiBaudrate;&lt;br/&gt;
aCom1Params&lt;span&gt;[2]&lt;/span&gt;.udiValue := 115200;&lt;br/&gt;
aCom1Params&lt;span&gt;[3]&lt;/span&gt;.udiParameterId := COM.CAA_Parameter_Constants.udiParity;&lt;br/&gt;
aCom1Params&lt;span&gt;[3]&lt;/span&gt;.udiValue := COM.PARITY.NONE;&lt;br/&gt;
aCom1Params&lt;span&gt;[4]&lt;/span&gt;.udiParameterId := COM.CAA_Parameter_Constants.udiStopBits;&lt;br/&gt;
aCom1Params&lt;span&gt;[4]&lt;/span&gt;.udiValue := COM.STOPBIT.ONESTOPBIT;&lt;br/&gt;
aCom1Params&lt;span&gt;[5]&lt;/span&gt;.udiParameterId := COM.CAA_Parameter_Constants.udiTimeout;&lt;br/&gt;
aCom1Params&lt;span&gt;[5]&lt;/span&gt;.udiValue := 0;&lt;br/&gt;
aCom1Params&lt;span&gt;[6]&lt;/span&gt;.udiParameterId := COM.CAA_Parameter_Constants.udiByteSize;&lt;br/&gt;
aCom1Params&lt;span&gt;[6]&lt;/span&gt;.udiValue := 8;&lt;br/&gt;
aCom1Params&lt;span&gt;[7]&lt;/span&gt;.udiParameterId := COM.CAA_Parameter_Constants.udiBinary;&lt;br/&gt;
aCom1Params&lt;span&gt;[7]&lt;/span&gt;.udiValue := 0;&lt;/p&gt;
&lt;p&gt;// Handshake Paramet&lt;/p&gt;
&lt;p&gt;//aCom1Params&lt;span&gt;[8]&lt;/span&gt;.udiParameterId := COM.udiDtrControl;&lt;br/&gt;
//aCom1Params&lt;span&gt;[8]&lt;/span&gt;.udiValue := 16#02; // handshake&lt;br/&gt;
//aCom1Params&lt;span&gt;[9]&lt;/span&gt;.udiParameterId := COM.udiOutxDsrFlow;&lt;br/&gt;
//aCom1Params&lt;span&gt;[9]&lt;/span&gt;.udiValue := 1; // true&lt;br/&gt;
//aCom1Params&lt;span&gt;[10]&lt;/span&gt;.udiParameterId := COM.udiRtsControl;&lt;br/&gt;
//aCom1Params&lt;span&gt;[10]&lt;/span&gt;.udiValue := 16#02; // handshake&lt;br/&gt;
//aCom1Params&lt;span&gt;[11]&lt;/span&gt;.udiParameterId := COM.udiOutxCtsFlow;&lt;br/&gt;
//aCom1Params&lt;span&gt;[11]&lt;/span&gt;.udiValue := 1; // true&lt;/p&gt;
&lt;p&gt;// Handshake Parameter&lt;/p&gt;
&lt;p&gt;aCom1Params&lt;span&gt;[8]&lt;/span&gt;.udiParameterId := COM.udiInX;&lt;br/&gt;
aCom1Params&lt;span&gt;[8]&lt;/span&gt;.udiValue := 1; // true&lt;br/&gt;
aCom1Params&lt;span&gt;[9]&lt;/span&gt;.udiParameterId := COM.udiXonChar;&lt;br/&gt;
aCom1Params&lt;span&gt;[9]&lt;/span&gt;.udiValue := 17;&lt;br/&gt;
aCom1Params&lt;span&gt;[10]&lt;/span&gt;.udiParameterId := COM.udiXonLim;&lt;br/&gt;
aCom1Params&lt;span&gt;[10]&lt;/span&gt;.udiValue := 2048;&lt;br/&gt;
aCom1Params&lt;span&gt;[11]&lt;/span&gt;.udiParameterId := COM.udiOutX;&lt;br/&gt;
aCom1Params&lt;span&gt;[11]&lt;/span&gt;.udiValue := 1; // true&lt;br/&gt;
aCom1Params&lt;span&gt;[12]&lt;/span&gt;.udiParameterId := COM.udiXoffChar;&lt;br/&gt;
aCom1Params&lt;span&gt;[12]&lt;/span&gt;.udiValue := 19;&lt;br/&gt;
aCom1Params&lt;span&gt;[13]&lt;/span&gt;.udiParameterId := COM.udiXoffLim;&lt;br/&gt;
aCom1Params&lt;span&gt;[13]&lt;/span&gt;.udiValue := 512;&lt;br/&gt;
aCom1Params&lt;span&gt;[14]&lt;/span&gt;.udiParameterId := COM.udiTXContinueOnXoff;&lt;br/&gt;
aCom1Params&lt;span&gt;[14]&lt;/span&gt;.udiValue := 0; // false&lt;/p&gt;
&lt;p&gt;END_IF&lt;/p&gt;
&lt;p&gt;IF xPortOpen THEN&lt;br/&gt;
//The first Port is opened with the given parameters&lt;br/&gt;
como1(xExecute := TRUE, usiListLength:=SIZEOF(aCom1Params)/SIZEOF(COM.PARAMETER),pParameterList:= ADR(aCom1Params));&lt;/p&gt;
&lt;p&gt;IF como1.xError THEN&lt;br/&gt;
xCom1OpenError := TRUE;&lt;br/&gt;
iState := 1000;&lt;br/&gt;
END_IF&lt;br/&gt;
IF como1.xDone THEN&lt;br/&gt;
iState := 10;&lt;br/&gt;
END_IF&lt;/p&gt;
&lt;p&gt;END_IF&lt;/p&gt;
&lt;p&gt;IF xWrite THEN&lt;br/&gt;
// the write process is started for the first port&lt;br/&gt;
comw1(xExecute := TRUE,hCom:= como1.hCom,pBuffer:= ADR(sWrite),szSize:= SIZEOF(sWrite));&lt;/p&gt;
&lt;p&gt;IF comw1.xError THEN&lt;br/&gt;
xCom1WriteError := TRUE;&lt;br/&gt;
END_IF&lt;/p&gt;
&lt;p&gt;// if the writing process is completed the reading process can be started&lt;br/&gt;
IF comw1.xDone THEN&lt;br/&gt;
iState := 15;&lt;br/&gt;
END_IF&lt;br/&gt;
END_IF&lt;/p&gt;
&lt;p&gt;IF xPortClose THEN&lt;/p&gt;
&lt;p&gt;// The first port is closed and the used handle released&lt;br/&gt;
comc1(xExecute := TRUE, hCom:= como1.hCom);&lt;/p&gt;
&lt;p&gt;IF comc1.xError THEN&lt;br/&gt;
xCom1CloseError := TRUE;&lt;br/&gt;
END_IF&lt;/p&gt;
&lt;p&gt;IF comc1.xDone OR comc1.xError THEN &lt;br/&gt;
iState := 1000;&lt;br/&gt;
END_IF&lt;br/&gt;
END_IF&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>RS232 Serial communication problems</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5cabc63909/?limit=25#25a6" rel="alternate"/><published>2020-02-27T14:08:36.956000Z</published><updated>2020-02-27T14:08:36.956000Z</updated><author><name>runar@samey.is</name><uri>https://forge.codesys.com/u/runar-samey-is/</uri></author><id>https://forge.codesys.com2b701562ec7c33b6e4400fc67549495758603928</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I am new to this forum and I am just beginning to us codesys. &lt;/p&gt;
&lt;p&gt;I am trying to get communication between berghof EC1000 and roboteq 2130. I am using 232 serial port. I am using a program I got from the codesys store ( &lt;a class="" href="http://store.codesys.com/serial-com.html" rel="nofollow"&gt;http://store.codesys.com/serial-com.html&lt;/a&gt; ). I am using Codesys v3.5 SP1 Patch 4.&lt;/p&gt;
&lt;p&gt;My problem is that I can send one message through the serial port whit out any problems, but when I try to do it again nothing happens. Then I have to logout from the project and download it again to be able to send the messages again. &lt;/p&gt;
&lt;p&gt;Can anybody please help me with this problem?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>