plcforum.uz.ua

International PLC Forum
It is currently Tue Oct 23, 2018 4:59 am

All times are UTC + 3 hours


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Sep 07, 2018 6:42 am 

Joined: Fri May 18, 2012 11:54 am
Posts: 15
Hi All,

I need block which we convert Real Value to ASCII and Int to ASCII format. I need to send command to printer.

Please let me know if any block is availbale for this.

Regards,

Yogendra K


Top
 Profile  
 
PostPosted: Fri Sep 07, 2018 9:42 am 
Faq & Info
Faq & Info

Joined: Wed Oct 05, 2005 12:00 pm
Posts: 391
(sfaq) https://support.industry.siemens.com/cs/document/1851190/how-can-you-convert-a-number-value-of-the-data-type-int-into-a-string-in-s5time-or-into-the-data-types-bcd-and-real
Quote:
4 Converting a decimal number into ASCII characters:
You can use the FC5 function, which can be found in the IEC library, to convert decimal digits into ASCII characters. The FC5 function performs the conversion. The block is configured with two transfer parameters:

Parameter "i":
number to be converted in double-word format
Parameter "RetVal":
Data type STRING into which the ASCII characters are written.

The FC5 function is called in the OB1, and the parameters are supplied accordingly. The result of the conversion appears in the DB1 from data block byte 2. You can monitor the result with the aid of a variables table.

S7iec.zip ( 135 KB )

Copy the "S7iec.exe" file into a separate directory and then start the file with a double-click. The STEP 7 project is now unpacked with all the associated subdirectories. You can then use the SIMATIC Manager to open and process the extracted project.
5 IEC standard function for the STRING variable:
Using the IEC standard functions FC5, FC16, FC30, FC37, FC38 and FC39 you can convert variables in the DINT format into a string and vice versa.

    FC5 DI_STRNG: Conversion of a variable of the DINT type into a variable of the STRING type.
    FC16 I_STRNG: Conversion of a variable of the INT type into a variable of the STRING type.
    FC30 R_STRNG: Conversion of a variable of the REAL type into a variable of the STRING type.
    FC37 STRNG_DI: Conversion of a STRING variable into a variable of the DINT type.
    FC38 STRNG_I: Conversion of a STRING variable into a variable of the INT type.
    FC39 STRNG_R: Conversion of a STRING variable into a variable of the REAL type.
More information is also available in our entry entitled "What standard STEP 7 functions are there for the conversion and comparison of string variables and ASCII characters?" in Entry ID: 10913338.
https://support.industry.siemens.com/cs/document/10913338/which-functions-and-iec-standard-functions-exist-in-step-7-for-converting-and-comparing-string-variables


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: Majestic-12 [Bot] and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by International PLCforum® Forum Software © PLCforum
Mobile version