Sign in to follow this  
Followers 0
kcor

math for distance-confused/braindead

4 posts in this topic

question have a encoder that gives me 120 pulses per 1 inch of travel. trying to figure out how to program so that a opertor could enter in a menu on nt20s display to move 1 inch or any value from 0-3 inches in increments such as 1.3 inches or 2.7 inches, etc. if 120 pulses = 1 inch, then if i divide 1 by 120, which equals .0083, then for every pulse, then the encoder has moved .0083 inches. So if a operator wanted to enter a value of 1.4 to move 1.4 inches, then any advice on how to accomplish this would be appreciated. I have worked on it for a couple of hours now, and just can not quite figure out the best approach. using a cqm1h cpu51, and trying to modify a program that is written with syswin. Any advise.

Share this post


Link to post
Share on other sites
Probably an easier way, but just a quick check came up with this. Multiply the operator entered value 1.4 (14 in plc register) by 10000, using a double multiply. Then double divide result by 83 to get the number of pulses required. I think this will work, maybe not the cleanest way to do it. Hope this helps.

Share this post


Link to post
Share on other sites
... Hi, GT's way should work fine and is probably the easiest way to program, note also that the CQM1H series supports floating point numbers (as expansion instructions). So you could convert your values to floating point, perform the calcs then convert them back. Nibroc Edited by Nibroc

Share this post


Link to post
Share on other sites
thanks for feedback will be going to a branch plant tomorrow and will try the suggestion.

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