Sign in to follow this  
Followers 0
Ben

Floating point ADD

9 posts in this topic

Hi everybody, I am using +F instruction to move my floating point value from DM1022,1023 to another DM1028,1029. (Using CQM-1H CPU61) Instruction is, +F DM1022 0 DM1028 My question is, It gives me "operand2 memory area not valid" when I try to use #0. I know that 0 means IR000 channel. On this I have some digital inputs. In above case, is it adding the value of channel 1 to my dm1022, I don't want that to happen. I tried with #00000000, #0.00 but not working! How can I add value 0 to my floating point?? (I saw in a code addition of -0, what does it mean?) Thanks, BEN

Share this post


Link to post
Share on other sites
I don't think you can add a decimal number as the addend word has to be of 32-bit floating type. Although the instruction help says so. A workaround would be to fill in a DM of which the value of the DM and the DM+1 is always 0. Additionally you could move 0 in DM and in DM+1 to be sure. I don't work with floating data that much so there must be a cleaner trick.

Share this post


Link to post
Share on other sites
Thanks Pdl, Which means the instruction help is TOTALLY HOPELESS!! and misleading. For the beginners like me it proves to be very costly. Anyways, I was already thinking in that direaction as last resort and did change my code to move 0 to DM, DM+1, and then use those DMs. However, this seems to be very long solution for a small problem. I'm not sure but MOVL should work. However, I don't have space to add this in my expansion instruction! However, i'm not clear whether add 0 means addding the contents (0-65535) of 16 bit IR0 or not. And what is this add -0? is it equivalent symbol for #0 or 0 or something else??

Share this post


Link to post
Share on other sites
Well if you can accomplish what you want with the instruction although it has another purpose, I don't think it is hopeless right ? Anyways, I never used the MOVL instruction but I think it will do what you want, move 2 consecutive words from S and S+1 to D and D+1. You are right if you use 0 as addend word with the +F instruction, that the word value that the inputs of IR0 reflect at that time wil be used as addend value. So no good. No idea what -0 could be used for. But if you are short on expansion slots, use the XFER(70) instruction. Should have thought of it in the first place. XFER(70) #2 DM1022 DM1028

Share this post


Link to post
Share on other sites
"Well if you can accomplish what you want with the instruction although it has another purpose, I don't think it is hopeless right ?" No offence! I was talking about the option of data types it shows for +F instruction. If # can not be used with floating point, why is it shown there! Anyways, thanks for hinting Xfer instruction.

Share this post


Link to post
Share on other sites
Thought you we're saying the instruction itsself is hopeless.. Out to get glasses...

Share this post


Link to post
Share on other sites
I have just had a look at the help in CX-Programmer fo +F and # is not shown as an option. In fact # means BCD and & means binary/HEX. The instruction help clearly states that all words have to be floating point to IEEE754 standard.

Share this post


Link to post
Share on other sites
Instruction help for +F in CXP V6.00

Share this post


Link to post
Share on other sites
Can't read Pim.

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