Witam klubowiczów proszę o pomoc w przetłumaczenia kodu z języka SCL na LAD lub FBD oto linijka kodu, używam TIA Portal V15.
// #elapsedTime (range): 0 to 4.294.967.280
// #elapsedTime (overflow): 4.294.967.295 (0xFFFF FFFF)
// If EdgeCount and ElapsedTime is valid, calculate the period
IF (#edgeCount > 0)
AND (#elapsedTime > 0)
AND (#elapsedTime <= 4294967280)
THEN
// Calculate the period in nanoseconds
#statPeriod := #elapsedTime / #edgeCount;
// Calculate the period in seconds
#statPeriod := #numPulsePerRot * #statPeriod / #BILLION;
END_IF;
// Check overflow (the period between two pulse edges exceeds 4.295 seconds)
IF (#elapsedTime = #OVERFLOW_VALUE)
THEN
#statOverflow := TRUE;
ELSE
#statOverflow := FALSE;
END_IF;
// Set period to zero, if overflow
IF(#statOverflow = TRUE)
THEN
#statPeriod := 0;
END_IF;
// Calculate speed in rpm
IF (#statPeriod > 0)
THEN
#speed := 1 / #statPeriod * 60.0;
ELSE
#speed := 0;
END_IF;
// Set output overflow
#overflow := #statOverflow;