PlasticsDude Posted March 24, 2007 Report Posted March 24, 2007 Generally speaking, how does one convert decimal time into clock time on a PLC? Eaxmple: 1.50 minutes = 1:30 (the 1:30 gets displayed on an HMI screen) Thanks for any help! Quote
Mickey Posted March 25, 2007 Report Posted March 25, 2007 (edited) What PLC ( vendor, brand) are you using? Edited March 25, 2007 by Mickey Quote
PlasticsDude Posted March 25, 2007 Author Report Posted March 25, 2007 Siemens S7...figured it would be about the same idea for most PLC's... Quote
Mickey Posted March 25, 2007 Report Posted March 25, 2007 (edited) I'm not familar with Siemens but the below works for AB stuff: Step 1 (1.5-.5)=1 ( result placed in an integer register, Hour component) Step 2 (1.5-1)=.5 ( subtract the above hour component from orginal number) Step 3 (.5*60)= 30 minutes ( Multiply results of step 2 by 60 this is your min. component, put result in an integer register) Only problem with this is that in step three the results could be rounded to 60 min., you might have to write logic to account for this. ( if above 59 then move 59 to min. else move min. to min.) Note when moving a floating point numbers to an integer rounding must take place. This works for AB PLC's. Not sure about Siemens. Edited March 25, 2007 by Mickey Quote
Recommended Posts
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.