2/13/2011 1:17 AM | |
Joined: 10/7/2005 Last visit: 11/12/2024 Posts: 3026 Rating: (1057) |
Hello Gaurav_79 the problem is a bug in hdhosseini's example logic. Avariable of format TIME is simply a DINT value in milliseconds (e.g. L#1000 = 1sec, see alsoS7 help for more on the format of a TIME type variable). Multiplying aDINT value with a REAL value via a REAL multiplication is of course bound to fail, so change the logic to something like below (note: omitted the ITD conversion which is only needed if the MW 0 could contain negative values whichis better be unlikely in case of a Time setpoint): [code]L MW 0 // Time setpoint as INT in full seconds L 1000// 1000ms/sec *D T MD 50 // Time setpoint as DINT in ms[/code] Having said that, if you use a DINT with linear scaling in WinCC you can even save you the hassle of the above conversion logic, alternativelyyou could use the "dwordtosimaticbcdtimer"adapt format in WinCC and below are a few selected links which can be found with a simple search on this subject: Simatic Timer tag S5Time value set from WinCC Linear scaling in WinCC How can you have a tag of the S7 data type S5TIME displayed in WinCC? Last but not least, hdhosseini's example logic delivers the correct result if executed in PLCSIM, this is however a (somewhat known) bug in PLCSIM(and one that Siemens will hopefully fix one day soon). I hope this helps |
Last edited by: fritz at: 2/13/2011 1:20 AMCheers |
|
This contribution was helpful to3 thankful Users |
Follow us on