Want to convert real to time in S7

JvdV

Member
Join Date
Apr 2003
Location
Halsteren
Posts
95
Hi there,

I need to convert a real number to an time value to put in an PID function of siemens and I'm not quiet sure how to do this.
So far I found out that the time is an dint. Do I have to convert the real first in a dint and then to time ?

All help is appriciated.

Jurgen
 
normaly a real value like (xxx.yyy) the xxx part means days to a base day(1, Jan, 1900). the yyy part is second of a day.

if yyy=5 means 12:00pm
 
If you are using the standard blocks like CONT_C, then the CYCLE parameter is in TIME format. TIME is really just a DINT representing the time in milliseconds.


If your REAL is in milliseconds already, then you can do this:

L rTime // rTime = REAL with time is milliseconds
RND
T tTime // tTime = TIME with time is milliseconds


If your REAL is in seconds, then you can do this:

L rTime // rTime = REAL with time is seconds
RND
L L#1000
*D
T tTime // tTime = TIME with time is milliseconds

notice: in both cases the fractional part of the REAL is discarded.
 

Similar Topics

Hi all. Me again still learning Rockwell. So I'll be polling an INT data array from a Modbus SE power meter with a L82 (with a Modbus ProSoft in...
Replies
56
Views
1,384
Hello, First, please excuse my question I am new to Modbus. I have a CX-5140 control unit from Beckhoff and an instrumentation device that...
Replies
3
Views
3,120
Greetings fellow PLC programmers, I know there is a simple way to get the system date time of the RSLogix system. But, is there then a way to...
Replies
12
Views
8,587
Hi Guys, i'm begginer and i'm trying to convert a real value (not fix value) to BCD. It works if i put fix real value but when i put variable...
Replies
2
Views
1,941
I converted 2 consecutive Ints to a Real using a Copy instruction. So now I need to reverse this process. Convert a Real into 2 consecutive Int's...
Replies
9
Views
2,450
Back
Top Bottom