I need to calculate step value for some time period like this:
targetLevel,currLevel,bStep - REAL
timePeriod - TIME
my TON1 has PT:=t#10ms and when TON1.Q I need to add bStep to bValue
Now I have Type mismatch in division so I think I need to convert TIME to REAL, or TIME to INT and INT to REAL
Is it possible?
Sorry newbie question
Conversion Operator TIME_TO_REAL
because the scantime is a problem, check if you can get the needed precision.
maybe you need the clocktime to get enough accuracy of the step.
another way to get correct results, is by adding the step/time in a way like an x/y line can be computed.
You can make use of the SysTime library, get the starting time in st1 and the stop time in st2, then calculate the elapsed time inbetween. It can be within a cycle or several cycles later, it doesn't matter.
st1, st2: SysTime;
//Get starting time (in us)
//Get stop time (in us)
//Calculate elapsed time (in us)
Log in to post a comment.