FET_Destroyer Posted January 23, 2014 Report Posted January 23, 2014 (edited) 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 January 23, 2014 by FET_Destroyer
BITS N BYTES Posted January 23, 2014 Report Posted January 23, 2014 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
FET_Destroyer Posted January 23, 2014 Author Report Posted January 23, 2014 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
BITS N BYTES Posted January 24, 2014 Report Posted January 24, 2014 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!!
FET_Destroyer Posted January 24, 2014 Author Report Posted January 24, 2014 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?
lostcontrol Posted February 1, 2014 Report Posted February 1, 2014 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.
FET_Destroyer Posted February 7, 2014 Author Report Posted February 7, 2014 (edited) 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 February 7, 2014 by FET_Destroyer 1
Crossbow Posted February 7, 2014 Report Posted February 7, 2014 Why are you making a string for an OPC server? OPC servers can receive the actual data without any conversion. 1
lostcontrol Posted February 7, 2014 Report Posted February 7, 2014 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
FET_Destroyer Posted February 11, 2014 Author Report Posted February 11, 2014 (edited) 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 February 11, 2014 by FET_Destroyer
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now