Sign in to follow this  
Followers 0
FET_Destroyer

convert 2 numbers into strings and CONCAT 2 strings

10 posts in this topic

Hello Guys, I'm with some problems converting decimal numbers to string. I'm using CJ1M, so I cannot use ST text, otherwise this will be simpler. I explain my problem. I have 2 decimal numbers in D600 and D800, I want to convert the numbers to string and then using the function +$ concatenate into something like this numberD600_numberD800. I try with and without the BCD function. I attached my code. Can someone help me to develop some routine in ladder to convert 2 decimal numbers in strings and then concatenate the strings together separated by a char (-). Regards Edited by FET_Destroyer

Share this post


Link to post
Share on other sites
I'm with some problems converting decimal numbers to string. I'm using CJ1M, so I cannot use ST text, otherwise this will be simpler. Of course you can use ST in a CJ1M. See attachment for converting UDINT to STRING. DINT to STRING CJ1M.cxp

Share this post


Link to post
Share on other sites
Hello BITS, I can use, it says that my cpu version is old, I have cpu version 3.1, that function only works on cpu version 4 :s

Share this post


Link to post
Share on other sites
OMG where did you get hold of that old PLC!! Version 3 was first released in July 2004, replaced with V4.1 in January 2008 and 4.2 in AUGUST 2008. Your unit is almost ten years old and obsolete [replaced with CJ2M + MD211/212 Pulse I/O Module] at less cost than the original CJ1M. Time to get a new one!!

Share this post


Link to post
Share on other sites
Hello, I think this PLC is from 2005. We have a bunch of CJ1M in here. I cannot replace all of CJ1M that we have, no budget for now, I update some CJ1M to CJ2M, but this have to stay CJ1M for now. Any ideas how to make that conversion to string using only ladder?

Share this post


Link to post
Share on other sites
Attached an example of converting Hex data to ASCII I do not think the CJ1M had pure string capabilities. What do you need the string for? Writing to a CF, HMI, Printer..? I have used this style for writing to serial printers, CF cards etc. Has required a bit more work than the attached, but this would be a starting point for you.

Share this post


Link to post
Share on other sites
Hello lostcontrol, Nothing is attached or maybe It's too late and already been removed. I've been out for a few days, only today I been able to see the posts. The string is just to be read by an OPC server. Edited by FET_Destroyer
1 person likes this

Share this post


Link to post
Share on other sites
Why are you making a string for an OPC server? OPC servers can receive the actual data without any conversion.
1 person likes this

Share this post


Link to post
Share on other sites
Crossbow makes an interesting point, why do you need to read the data as a string? Is it a requirement of the OPC server, or the application? What is your intent for this? There may be better ways to achieve the same thing without conversions... FET-Convert.cxp

Share this post


Link to post
Share on other sites
Hello Guys, I need to convert because I have an application using FINS that read a string from PLC., when I said OPC is not OPC, is an application made by me. I did it by to ways, first I did it in the application, the application reads all the scrambled data and then rearrange it, not a very good idea for me, i like to keep my applications as simple as possible. After that I tweak a little bit lostcontrol code and now its being done on the PLC. thanks for all support Edited by FET_Destroyer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0