Jump to content

Recommended Posts

Posted
Hello all Please could you answer a couple of queries.Am I right in thinking that you can't do decimal calculations with the fx1s,and am i missing something with the 'H' numbers in the "to/from" instructions for reading/writing to a/d modules.(The instructions for these are not very clear) Thanks Ricicle
Posted
wellcome to the forum. TO and FROM instructions are used to communicate with expansion cards (read and write buffers in those cards) and FX1S is not expandable. H you mention is used in those instructions (among others) to specify hard-coded value in hex (h50 = 0x50 = 80 decimal). Decimal identifier is K such as K80 and H50 is same as K80. h100=K256 etc. Both K and H are supported and interchangable but obviously one needs to use correct value. but what do you mean by decimal calculations? +,-,*,/ etc? all of this and more is supported. what decimal? 16-bit integer, 32-bit integer? floating point?
Posted
Panic mode thanks for the response.No,I know about hex format but there seem to be some additional "H" numbers in the to from instructions e.g [TO K0 k17 H0004 k1].I know they are something to do with setting up which channel you are dealing with and what you want to do with it but they seem to differ with diffrent modules,and as I said before the instructions with these modules are not very clear. As for the decimal for example if I wanted to multiply say D200 by 0.8 is that possible (ie calculate using numbers smaller than 1) thanks ricicle
Posted
Hi, What you are referring to is dividing a decimal with a float. This can be done, but with the FX2N and upwards. You would typically convert the decimal to float using FLT instruction and the do a EDIV. Also, some other functions are available: EADD ESUB ENUL EDIV (As mentioned) ESQR FLT INT ECMP EZCP EBCD EBIN You can download the manuals in the downloads section here. Regards, WayneS
Posted
Hi, You are asking about floating point calculations, it is not supported in Fx1s PLC. But however if the calculations are small you can achieve floating point calculations. For example Multiplying D200 with 0.8 you can do following in Fx1s i)Multiply d200 with 8 ii)Divide result found above with 10 ii)Result in step (ii) indicates d200 multiply by 0.8
Posted
Thanks Sid.I actually did that (in the end multiplying by 4 and dividing by 5) because of the main reason for me asking which is:The result after I had multiplied by 10 was greater than 32767(16 bit) even though it was smaller after the division and I was trying to display the result on an E150 HMI using the data register that was assigned after the division and the display was all over the place(the display was ok for numbers that didn,t go over the 16bit limit in the multiplication stage) Any ideas Thanks ricicle
Posted
Ricicle I think your problem is possibly in two areas.The first is around what happens when basic maths is used in Mitsi PLCs. If you multiply two 16-bit registers together you get a 32-bit answer even if all the higher register bits are 0 so you need to view the result as 32-bit to ensure accuracy. The destination register defined in your instruction is the LS register. When you divide, if the values to be calculated are potentially 32-bit (as could be the case here) you will need to use a 32-bit divide instruction (DDIV or D/). This will cause the result to be found in the first two destination registers defined in your instruction and the remainder appearing in the next two registers (four registers used for the result of a 32-bit divide). Obviously, both these values need to be viewed as 32-bit numbers unless, as you say, the initial multiply result is less than the 16-bit limit, when all the upper registers in the 32-bit calcs will be 0. The second area is the display capability of the E150 HMI. Not sure about this as I've not used that model for some time but is it not possible to display 16-bit register values using an Analogue Object assigned as, say, D100 and to display a 32-bit register value using the notation D110L, for example? Summary 16-bit multiply D0*D1=Dn ,D(n+1) 32-bit result 16-bit divide D0/D1=Dn , D(n+1) 16-bit result , 16-bit remainder 32-bit divide (D0,D1)/(D2,D3)=[Dn,D(n+1)],[D(n+2), D(n+3)] 32-bit result , 32-bit remainder In all cases Dn is the root destination register defined in the instruction. Hope this makes sense and is of some help. The Cat
Posted
You can do following.. i)mul d0 k4 d2 i.e d2 and d3 contains 32bit result (16 bit multiplication) ii)ddiv d2 k5 d4 i.e d4 & d5 contains result and d6 & d7 contains remainder .(32 bit division) If you are sure that after division your result is 16bit then you can use above instructions in plc and use d4(16bit) for display purpose in E150

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...