Sign in to follow this  
Followers 0
sturtles

A little problem with data range

7 posts in this topic

Hi guys, I have a little problem with "Set a value" for negative values. In Run mode, I am only allowed to eter &0-65k and #0-FFFF. The values are held in the DM area(values are displayed as Hex) However, sometimes, CX programmer will display the word as integers or float, and this allows me to enter the full range of value ie. -32k to +32k Does anyone knows why?

Share this post


Link to post
Share on other sites
Have a look at word type. Integer 0-65k, channel 0000-FFFF, signed integer -32k to +32k, BCD 0-9999.

Share this post


Link to post
Share on other sites
Hmm... I tried to change the value of symbol type to real for the source and target addresses, but it doesn't allow me to Eg. MOVL D100 D102 Under "Edit Instructions", I clicked on the "..." of D100, its originally displayed as CHANNEL for "symbols of type" and i changed it to REAL, but after clicking ok, it still doesn't register my action. Ialso tried "edit symbol" and tried changing CHANNEL to something else, but it says only CHANNEL and BOOL are allowed. Is there any other place that needs to be changed"

Share this post


Link to post
Share on other sites
What PLC are you using? If CS1 or CJ1 you can change the word type in the symbol editor, not on line though. Real is IEEE 754 format. The first bit is the sign, the next 8 bits are the exponent and the remainding bits are the manittisa with an assumed (1.) - the mantissa in other words is the value after the decimal point. If you do not have a REAL value, you have to turn the value into REAL before you can use it for calculations. Then FIX (or FIXL) it back to decimal.

Share this post


Link to post
Share on other sites
Thanks Bobb. You're right about the datatype. Somehow, the CX programmer refuse to allow me any change in "type" in the editor because it is not "named". I have only given them comments, hence only Bool and Channel is available for choice. Not sure why they do this though. Thanks mate!

Share this post


Link to post
Share on other sites
Hello sturtles, If the addresses only have comments, then they are not really symbols (although they are known as "Unnamed Global Symbols") - this is a legacy attribute I believe, left over from the days of limited character symbol names (6 or 8 maximum?), therefore people chose to use the comment as a way of having a more expressive method of naming the address. When CX-Programmer references an address with just a comment, it is purely the address that is being used, and therefore it cannot know what data type it is (hence only BOOL or CHANNEL). It is only when a symbol is named that it is 'properly' registered within the symbol tables, thereby allowing CX-Programmer to reference the name (and hence the data type). Hope this helps explain things a little. Regards anonymous

Share this post


Link to post
Share on other sites
Floats are a pain in the "butt-hocks" (© Forest Gump) in Omron. For example (and unless anyone can tell me otherwise) there is no easy way of assigning a floating point default to a DM area (or any other). Example: [MOV &3443 D3000] is straight forward; we can reference D3000 shortly afterwards, knowing that 3443 is contained in D3000. As for moving a floating point constant into a floating point word, I use a floating point [add] instruction: [+F +5.0E+1 +0 D3000] to shove a floating point hard-coded constant (50.000) into the 32bits registered as floating point. After that, a [MOVL] instruction will pick up the 32 bits and dump them into another 32 bits in floating point format, or floating point maths can be performed on D3000 or on the word beginning [dest] in the [MOVL] instruction. Interestingly, the destination can be any arbitary word, not yet given a symbol or data type... say D17020, and any floating point instructions on D17020 will yield floating point results - this is my experience for CJ and CS1H PLCs anyways. The point being, as long as you get the numerical value in floating point format, Omron PLCs will perform floating point maths on them quite happily. But, the initial placing of a floating point value into a floating point symbol requires coding in IEEE format as used by Omron: +5.0E+1 <why didn't I become a bricklayer? Maybe 'cos it's cold outside...? > Edited by MuttsNutts

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