Sign in to follow this  
Followers 0
308guru

How do I use decimals on an FX1N ?

10 posts in this topic

I haven't worked with decimals on the Mitsubishi plc's before. I'm using an FX1N-14MR I have two different plc programs, each for a different software level that I need to display. On my E150 display, I would like to display either 2.0 or 3.0 on a screen. I can put the 2.0 or 3.0 in the device memory or anywhere I guess. It's a static value. Could somebody explain where it should go, how it should be entered, and how I would display it on the E150. I know that's a lot, but I guess I need a beginners lesson in decimal use. Thanks.

Share this post


Link to post
Share on other sites
Unless you use real (floating point) numbers, you won't be able to store a decimal value in a normal data (D) register in the PLC. This value must be an integer, ie a whole number. So the trick is to store the values as 20 and 30 in the PLC (not 2.0 and 3.0), then use the scaling function of the E150 to divide this value by 10 and display 1 decimal point. I use the MAC screens ability all the time to scale integers to engineering units .... so much easier than having to convert to floating point, do the maths and then convert back to integers. For example, on QnA series PLCs with 8 channel analogue inputs reading 4-20 mA signals from 0-100 C temperature probes, I set the analogue input to read 0-20 mA, meaning that 0 bits = 0 mA, 800 bits = 4 mA and 4000 bits = 20 mA. Thus, on the MAC screen, set the scaling values: Controller Values 800 - 4000, Screen Values 0 - 100. The MAC software then works out the m and the C value for the straight line (y=mx+c) joining the points (800,0) and (4000,100) by solving the double simultaneous equations. Works like a charm ... and I just can't believe that there are other screens out there that don't do this function. Incidentally, the reason for setting the analogue input channel 0-20 instead of 4-20 is that the PLC can read all the way down to 0 mA, so I can set error states at, say, 3.5 mA, which allows the transducer to float a little below 4 mA and still be "good". I digress ....

Share this post


Link to post
Share on other sites
Thanks for the info. I haven't done that before, but it looks pretty simple. Just for learning purposes, how are floating point numbers used? Where are they stored? Like I said, I haven't used them before. Are there any pages in the manual that would give me the info? Thanks.

Share this post


Link to post
Share on other sites
I had this project very recently. I suggest the easiest way of doing so is to use an FX3U plc as they support real numbers ,if you need to control within the plc. There is a way of doing it in the fx1N range but it's quite complicated in comparison. The numbers have to be converted to binary, the real integer flag has to be triggered on and only then does the fun begin. Use GX IEC and simply drag a few function blocks together and voila, all done. else keep it in whole integer numbers and use scaling on Terminal. Hope this solves some issues.

Share this post


Link to post
Share on other sites
Real number (floating point) are stored in the PLC using 2 consecutive data registers. There is no special area to store them in. For the FX1N, get manual JY992D88101 (which should be in the downloads here or www.meau.com).

Share this post


Link to post
Share on other sites
The FX1S and FX1N cannot do true floating point. You can use scientific notation, which is closely related, but as Lazyboy says, it ain't pretty. What I usually do is store my values (temperature, pressure, whatever) in 1/10s or 1/100s of the unit I want, and using scaling in the HMI to display it with a decimal point. I use comments to label the registers so I don't forget the units. The only sticky part is that integer division doesn't do rounding, so you have to build that into the code if that's a problem.

Share this post


Link to post
Share on other sites
Looking for a little more help here. It sounds like the scaling feature is the simple way of displaying what I want. I tried adding this to my program but I'm having trouble. I want to display 3.0. I added "analog numeric" to my display. I have it set to display D1151 which is where my value is stored. Positions = 2 and decimal = 1. No matter what the offset and gain are set at, I keep getting an error "value is too large" or "value is too small" The manual has about 1 sentence to describe the scaling function. Could somebody explain how to set this up? Thanks.

Share this post


Link to post
Share on other sites
You're not setting the Position and Decimal parameters up correctly. "Positions" is the total number of characters you want to display, including the decimal point. "Decimal" is the number of digits to the right of the decimal point. So, to display the number "12.34", you would set Positions = 5 and Decimal = 2.

Share this post


Link to post
Share on other sites
In E-Designer, if your data register is a signed 16 bit register (an INTEGER not a DOUBLE INTEGER), then the range of numbers the terminal will expect to display is -32767 to +32767. You will see that -32767 takes up 6 spaces if you include the negative sign. Normally leave positions set at the default 6, unless you have space restrictions on the screen. You can also choose to show leading zeroes if you like. So, if you have -300 in the data register, and you want to display -3.00, with positions 6 and dp 2, this would show -03.00 with preceding zeroes showing, or -3.00 without. Your scaling would be 0 to 300 in the controller and 0 to 3 on the HMI.

Share this post


Link to post
Share on other sites
and yet another way I remember using was a false decimal point. The figure I was playing with was in 10ths so I divided it by 10 and this rounded it off. I then multiplied by 10 to get my original figure but rounded off. I then subtracted this new figure from the original to get the unrounded off last number. Then I displayed the first figure (divided by 10) then just put a false decimal point then the unrounded off last number - lol hope you understood that

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