Sign in to follow this  
Followers 0
speakerman

Double registers... how do I assign/use them?

5 posts in this topic

Hey there to all the people who understand the magic of the MSB... I am relatively new to the Mitsubishi platform and am having some difficulty working through the mass of information in the manuals to find a specific instruction. Hopefully someone out there can pass on an easy fix to this problem: I have data registers for sending the speed control frequency to several VFD remote devices on a CC-Link. The interface for setting the speed registers and ramping in an accelerated way for graduated adjustments works well, and the operators like the way that performs. My only remaining wrinkle is that I need to be able to convert that number to an rpm for speed display, and the trouble is that the frequency register resolution is from 33 to 7833 in single integer increments. This represents frequency in hertz x 100, where 60.00 Hz is stored in the register and read by the drive as 6000 for a speed of 1800 rpm. I need the resolution to remain this accurate, as this is a steel milling machine and the rpm is critical during larger cut cycles. I tried dividing the frequency by 3.33 for an accurate conversion to rpm, but I'm not allowed to use decimals unless I delve into the world of floating point. Next I tried multiplying it by 100, then dividing it by 333, which would give the same result. This seemed to work, as the destination register stored the higher value after the multiplication, using two consecutive registers to store the number as the value exceeded the capacity of a single 16 bit unit. The problem occurred when I tried to reference those registers to divide them by 333. It kept showing negative numbers, as it wouldn't reference both of the destination registers holding the result of the earlier multiplication. It appears that the follow-up DIV function was only reading the first register, which usually had a 1 in its MSB location, making the answer negative. I have read through the massive manual for any information on how I can make the DIV function reference both registers for a 32 bit value, and divide that by 333 getting a result that would of course fit into my display register, but although there are many references to double registers, I cannot find any instruction as to how I reference them in a math function. The data is there properly in the multiplication rung, showing the value, (example - frequency of 2000 multiplied by 100, correctly displayed in the destination register as 200000) and on the very next line, that same register is referenced in the DIV function, and shows a value of -XXXX. Is there a way to make the DIV function to read the value of both registers for the calculation? Or is there another function I have to use to achieve this? Note that this is a display issue for feedback to the operator, and the system does perform well. I'd really like to be able to give them a readout that correctly reflects the speed their motor is about to run when they turn it on. So far they are happy with the system overall and just compensate for the "drift" they see between the setpoint and the actual output. I hope someone out there has either seen the problem or can point me in the direction of a page or section in the programming manual that actually describes how to reference a double register, with a typed example of how it would look in a rung. Or a simple way to use 3.33 without too much complexity... Thanks in advance for any help that you can give, and for providing this great resource. B. Woodley, Innotech http://www.innotechglobal.com

Share this post


Link to post
Share on other sites
The answer is easy when you want an instruction to use double registers you add a D in front of the instruction in this case DIV => DDIV. The same applies if you want an instruction to be activated once on the rising edge. then you add a P on the end DIV => DIVP or both DDIVP In the basic programming manual one of the first chapters shows you all the varients you can use Edited by Gambit

Share this post


Link to post
Share on other sites
Thanks very much for that, Gambit! I figured it had to be something simple I was missing. It's weird that with all the searching and reading in the manual that I haven't come across an example of that yet. Either that, or I looked right at it without realizing... Cheers, B.

Share this post


Link to post
Share on other sites
One thing you should be careful about is, double multiplication and division uses 4 registers for output. DMUL D0 D2 D4 uses D4,D5,D6,D7 for output DDIV D0 D2 D4 uses D4,D5,D6,D7 for output D4,D5 result, D6,D7 remainder Edited by funfrok

Share this post


Link to post
Share on other sites
JY992D88101-D (download here or www.meau.com) Section 4.12 details use of data registers. Section 5 covers instructions, starts off with explanation of 16-bit vs. 32-bit. Section 5.3 is math instructions.

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