<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to ASCII</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/ab0820dab7/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/ab0820dab7/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/ab0820dab7/</id><updated>2020-02-27T23:26:04.083000Z</updated><subtitle>Recent posts to ASCII</subtitle><entry><title>ASCII</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ab0820dab7/?limit=25#7619" rel="alternate"/><published>2020-02-27T23:26:04.083000Z</published><updated>2020-02-27T23:26:04.083000Z</updated><author><name>erik.gerrits</name><uri>https://forge.codesys.com/u/erik-gerrits/</uri></author><id>https://forge.codesys.combebf2a0f3fb10f828064417ab480ebe05c866fb0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;To convert decimal to ASCII you can also use a pointer.  I have not tried to use a pointer to convert ASCII to decimal but I would imagine it would be the same thing since you are just pointing to a memory location and pulling the data in the type that you need it.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>ASCII</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ab0820dab7/?limit=25#b90a" rel="alternate"/><published>2020-02-27T23:25:59.423000Z</published><updated>2020-02-27T23:25:59.423000Z</updated><author><name>thebig1</name><uri>https://forge.codesys.com/u/thebig1/</uri></author><id>https://forge.codesys.comdf123e6fa2653e79e2d224c17fd8034bc8a5e02e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks for that.&lt;/p&gt;
&lt;p&gt;Is there anyway to show the careracter of the ASCII code?&lt;br/&gt;
For example, I need to send "SMFHD4BCOCGKS1508" over CAN&lt;br/&gt;
So I have to convert the whole of it to DEC first, then send via CAN as BYTES.&lt;br/&gt;
At the other end I have to recieve the CAN BYTEs, convert to DEC, then back to the ASCII caraters.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>ASCII</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ab0820dab7/?limit=25#47c2" rel="alternate"/><published>2020-02-27T23:25:57.767000Z</published><updated>2020-02-27T23:25:57.767000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com257eb6b6e2dc71dd708fe92fd4be7c3f4eab8b07</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;real_to_string&lt;br/&gt;
int_TO_STRING&lt;br/&gt;
ETC&lt;br/&gt;
OTHERWISE HAVE A LOOK AT THE OSCAT.LIB&lt;br/&gt;
at oscat.de&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>ASCII</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ab0820dab7/?limit=25#6b29" rel="alternate"/><published>2020-02-27T23:25:56.105000Z</published><updated>2020-02-27T23:25:56.105000Z</updated><author><name>JAPIB</name><uri>https://forge.codesys.com/u/japib/</uri></author><id>https://forge.codesys.com07117be3faa43b74ecd502747df3318e62c21833</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;To convert a décimal digit to ASCII, you have to ADD 50 to your decimal digit.&lt;br/&gt;
For example : 5 (decimal digit) --&amp;gt; 5 + 50 = 55              &lt;br/&gt;
55 is decimal ASCII code for decimal digit 5&lt;/p&gt;
&lt;p&gt;To convert a hexadigit to ASCII, you have to ADD 16#30 to your decimal digit.&lt;br/&gt;
For example : 5 (decimal digit) --&amp;gt; 5 + 30 = 35         &lt;br/&gt;
16#35 is hexa ASCII code for decimal digit 5&lt;/p&gt;
&lt;p&gt;To convert a number you must isolate each digit includes the number, then add 50 or 16#30 to each isolate digit&lt;/p&gt;
&lt;h2 id="for-example-to-convert-val1-to-ascii-code"&gt;For example to convert VAL1 to ASCII code :&lt;/h2&gt;
&lt;p&gt;VAR&lt;br/&gt;
Val1:UINT:=24;&lt;br/&gt;
VAL2, Dec_ASCII,Unit_ASCII : UINT;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;hr/&gt;
&lt;p&gt;(&lt;em&gt;Program&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;(&lt;em&gt;Decade&lt;/em&gt;)&lt;br/&gt;
Val2:=Val1/10                     (&lt;em&gt;result =2, decade&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;(&lt;em&gt;ASCII code for decade&lt;/em&gt;)&lt;br/&gt;
Dec_ASCII:= Val1 + 50 = 52  (&lt;em&gt;ASCII code for "2" &lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;(&lt;em&gt;ASCII code for unit&lt;/em&gt;)&lt;br/&gt;
Unit_ASCII:= (Val1-(10 x Val2)) + 50 = 4 + 50 = 54  (&lt;em&gt;ASCII code for "4", unit&lt;/em&gt;)&lt;/p&gt;
&lt;hr/&gt;
&lt;p&gt;In this example, Val1 is only composed of 2 digits.&lt;br/&gt;
The program will be longer if val1 is more long !  &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>ASCII</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ab0820dab7/?limit=25#52e0" rel="alternate"/><published>2020-02-27T23:25:51.483000Z</published><updated>2020-02-27T23:25:51.483000Z</updated><author><name>thebig1</name><uri>https://forge.codesys.com/u/thebig1/</uri></author><id>https://forge.codesys.comc8d32c4cb59ce8e1f1f25047e477d05cc2256299</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi All,&lt;/p&gt;
&lt;p&gt;I am quite new to CodeSys and have a queestion.&lt;/p&gt;
&lt;p&gt;I need to convert a Decimal or Hex to ASCII.&lt;/p&gt;
&lt;p&gt;Is there a simple way of doing it?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>