<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Data STRING sending to serialComm</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/896035ce4b/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/896035ce4b/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/896035ce4b/</id><updated>2022-03-22T08:59:30.473000Z</updated><subtitle>Recent posts to Data STRING sending to serialComm</subtitle><entry><title>Data STRING sending to serialComm</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/896035ce4b/?limit=25#2222" rel="alternate"/><published>2022-03-22T08:59:30.473000Z</published><updated>2022-03-22T08:59:30.473000Z</updated><author><name>damian177</name><uri>https://forge.codesys.com/u/damian177/</uri></author><id>https://forge.codesys.comabeabdb2436cbe330c5f9469e92449af89ba2fd6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;right,&lt;br/&gt;
thanks.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Data STRING sending to serialComm</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/896035ce4b/?limit=25#29f9" rel="alternate"/><published>2022-03-22T08:56:58.757000Z</published><updated>2022-03-22T08:56:58.757000Z</updated><author><name>timvh</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.comb0be0566e7f71accd8f7d56f30bedbbeee73ab4d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;IF your string will remain less than 255 characters (which should be, because you defined it as standard string, so this will be max 80), then you can use the function LEN(sw1).&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Data STRING sending to serialComm</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/896035ce4b/?limit=25#f116" rel="alternate"/><published>2022-03-21T12:21:23.310000Z</published><updated>2022-03-21T12:21:23.310000Z</updated><author><name>damian177</name><uri>https://forge.codesys.com/u/damian177/</uri></author><id>https://forge.codesys.com47170b2a0d1dc0759485e773077afad334180617</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
I send String data to serial com to thermal printer like this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;sw1&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="s1"&gt;'DATA:'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;dwWritten&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;SysComWrite&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hCom&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;hCom&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pbyBuffer&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;ADR&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sw1&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt; &lt;span class="n"&gt;ulSize&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;SIZEOF&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sw1&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt; &lt;span class="n"&gt;ulTimeout&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pResult&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;ADR&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Result&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;When I do not change my data in sw1 variable - everything is ok.&lt;/p&gt;
&lt;p&gt;When I change my data and send to serial com like this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c"&gt;sw1:= '12';&lt;/span&gt;
&lt;span class="err"&gt;dwWritten := SysComWrite(hCom:= hCom, pbyBuffer:= ADR(sw1), ulSize:= SIZEOF(sw1), ulTimeout:= 100, pResult:= ADR(Result) );&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Result on printer is bad , because I get on my printer my chars with "bushes" .... How can I change SIZE of my variable to send?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>