Tom749 Posted July 13, 2011 Report Posted July 13, 2011 (edited) Hi, I work for the variable timer preset value on the PLC ladder following the HMI setting value now. So at first on the (STEP1) I set the timer-value on the HMI screen as you can see it on the attached picture. Then on the (STEP2) the DB value is moved to the timer_sv1 for the matching of the SD instruction. On the (STEP3) the inputed value by the HMI moves to the preset-time value of the SD timer instruction. But there is a problem that as follows: When I enter the 1sec on the HMI screen the setting value on the PLC ladder is displayed as 100ms. When I enter the 1.5sec on the HMI screen the setting value on the PLC ladder is displayed as 150ms. When I enter the 1.6sec on the HMI screen the setting value on the PLC ladder is displayed as 100ms. When I enter the 2sec on the HMI screen the setting value on the PLC ladder is displayed as 140ms. What is the reason such as the results and how can I handle those for my purpose? My purpose is that the setting value between HMI and PLC should be same each other every time. (The wanted value range is from 0sec to 99sec by the 0.1sec gap.) (The data type of the HMI is DINT, DB is DINT, #timer_sv1 is S5TIME for the SD instruction) Thnaks for your help in advance. Edited July 13, 2011 by Tom749
Groo Posted July 13, 2011 Report Posted July 13, 2011 (edited) The S5Time preset is in BCD, 4 digidts, the right hand didgit can be 0, 1, 2 or 4 and this is the time base, 0=10mS, 1 = 100mS, 2 = 1S and 3 = 10S. The time itself can be 0-999 in BCD. So your number you send from the HMI, you want it to be 1 second, then you would need to place a 3 as the first BCD character, 3001. Read the help o the timer (highlight timer and press F1). EDIT: In reality you would want the time base to be as small as possibe as this will give your timer less error. So the best way possibly is to muliply the number entered by 100 and then convert to BCD. SFB4 and 5 are IEC timers held in the standard libraries, these timers have a base of mS. Edited July 13, 2011 by Groo
Moggie Posted July 13, 2011 Report Posted July 13, 2011 What HMI are you using? If Siemens then you could use Linear Scaling for this, see attachment Doc.pdf
Tom749 Posted July 14, 2011 Author Report Posted July 14, 2011 (edited) Thanks for your help again. Is there any function or ways for converting the decimal or hexa to BCD? Edited July 14, 2011 by Tom749
Groo Posted July 14, 2011 Report Posted July 14, 2011 There are instructions to convert data, I would need to find the old PDF's of the instruction sets. No time now will do that later if no-oe else has.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now