Storing multiple 32bit float values in consecutive 16bit registers, is this an error or an old trick?

I'm relatively new to programming PLC 's. So, I don't want to assume that what I'm seeing is an error. Perhaps it is an old trick, and I just don't understand why it's in the code. I have inherited a project and what I'm seeing, I just don't understand.

PLC is an IDEC FC5A. The automation at this location was set up 15 years ago or so. The person who originally did the programming left the area 5 to10 years ago. There was no documentation left behind.

I plugged in to the PLC and was able to upload the code from the PLC to my laptop. The ladder logic did not have any comments stored in the PLC with the logic. So, I've just been examining it.

I have identified some changes that I wish to make, However, I've also seen what appears to me to be errors in the code. I'd like to make sure that I'm not just missing something as a new person that is perhaps a technique used by more experience programmers.

What I am seeing is that a 32-bit floating-point value will get stored into a register such as D403. That should take up register D403 and register D404 since each register is 16 bits. Then another 32-bit floating-point value will get stored in to register D404, and again, another 32-bit floating-point value will get stored in to register D405 and yet another 32-bit floating-point value will be stored into D406

The confusion that I have here is that the first value that is stored in D403 should be taking up D403 and D404. So, storing a second value in D404. is overriding part of the first value stored in D403 right? Then the value stored in D405 is overriding part of the second value stored in D404? This continues on and on. I see it quite often in this code.

Are these errors? Did the original programmer not realize that floating point values took up two consecutive registers or is this some type of useful register manipulation done by experienced programmers.

Some of the changes that I want to make are to registers such as this that get overwritten. I'd like to understand what is happening here, and if these are errors, I can go back and fix all of this code so that 32-bit floating-point values are given two registers to store their data and are not overwritten by other values. I don't want to make any changes until I understand what's happening or if this is just a programing error.

Thank you.
 
are the floating-point numbers written directly to the data registers or converted first? are the data registers used to permanently store data or are they just being used as a scratchpad area and overwritten quite often with temporary calculations?
 
Some are stored directly, and some are converted. They don't seem like they are used for temporary storage as the rungs are often back-to-back so one will be overwriting the other before the first one is even used anywhere. Here is an example of several rungs. I don't know why they are converting a float to a float instead of just storing the float in the first place but either way you can see that in the consecutive rungs they are storing floats in D30, D31, D32, D33, D34, D35.

rungs.png
 
I understand the use of Float-to-Float conversion now. The user's manual I download states that for the MOV instruction, when a constant number is designated, you can use word, integer, double word, and long word data types. So, no float. About the CVDT instruction the manual says, that if both the source and destination are the same the CVDT functions like the MOV instruction but with the CVDT you can use the float data type, so I guess that is why they did that. That still does not explain why they try to store a 32-bit float in a single 16-bit register
 
The more I look at this I think it just has to be that the original programmer didn't know that 32bit values took two consecutive registers because there is not a single float assigned that is allowed to take two registers except if it is the last register in one of these sequences such as the D35 register in the image above. It only gets two registers because there was nothing stored in D36.
 
Top