These are two different data types: float and a string. You'll have to utilize the AIC instruction after breaking up the float into some integers. Have you tried a search in this forum, I have to believe its been addressed here before.
When moving a Float to a INT you need the change the length of the move instruction to "2". Float is 32 bit and INT is 16 bit.
Example:
F8:0 will fill two ints N7:0 and N7:1
Converting that to ASCII strings, especially in a MicroLogix, requires more than just moving a few bytes around.
The MicroLogix/SLC-500 operating system doesn't have a REAL-to-String conversion instruction like the ControlLogix/CompactLogix does.
So you'll have to write a routine to extract each digit of the floating-point number by division and truncation, then use the Integer to ASCII (or simpler math adding single digit values to the ASCII value for Zero) to put those values into a String.
It's a little tricky for a novice; I'd probably spend an hour writing and testing such a routine. Maybe somebody has an example handy, or you can find one in the archives.
As long as you are satisfied with the result I guess it's ok.
I, just for curiosity, would like to see the sequence of instructions you used, the final contents of the float,long and string and the significance of the value you are moving.
I think what Ken is saying (not about the dead guy) is that you might be able to make the move but if not done correctly the data won’t be valid after the move (Ken correct me if I’m wrong).
The instruction will be verified by RSLogix 500, but I don't think Ateall217 will get the result he wants.
Using the MOV instruction will convert between datatypes automatically. For example:
Code:
MOV
Source F8:30
12345678.910
Dest L11:0
12345678
MOV doesn't work on Strings, except to move ASCII codes into the string data elements.
Maybe ateall217 used the ASCII to Integer (AIC) instruction on the Long Integer value, to convert that to a String. In the MicroLogix 1400, both ordinary N files and long-integer L files can be used as the source for the AIC instruction.
I didn't recomend that at the beginning because he specifically asked about converting a floating point value, not the whole number portion of a floating point value.
I did use the AIC function to convert the long internet to string.yes, I should have been more spisific . I was trying to move a total counter with a value over 39000 to a string file. I tried posting a pic but was unsuccessful.