Omron NY532-5400 Reference Manual page 1429

Ny-series
Hide thumbs Also See for NY532-5400:
Table of Contents

Advertisement

Sample Programming
This example reads the task period of the current task when this program is first executed after opera-
tion starts. Then the task period that was read is converted from TIME data to LREAL data in millisec-
onds. This sample programming can be used, for example, to calculate the axis target position for each
task period.
The following procedure is used to convert TIME data to LREAL data in milliseconds.
1
The GetMyTaskInterval instruction is used to read the task period as TIME data.
2
The TimeToNanoSec instruction is used to convert TIME data to LINT data in nanoseconds.
3
The LINT_TO_LREAL instruction is used to convert LINT data in nanoseconds to LREAL data
in nanoseconds.
4
The DIV instruction is used to divide the result of step 3 by 1,000,000 to convert to milliseconds.
LD
Variable
Intv_tm
Intv_ns
Intv
P_First_RunMode
Intv_ns
ST
Variable
Intv
IF P_First_RunMode = TRUE THEN
Intv := LINT_TO_LREAL(TimeToNanoSec(GetMyTaskInterval()))/1000000;
END_IF;
NY-series Instructions Reference Manual (W560)
Data type
Default
TIME
T#0s
LINT
0
LREAL
0
GetMyTaskInterval
EN
ENO
Intv_tm
LINT_TO_LREAL
EN
ENO
In
Intv
Data type
Default
LREAL
0
2 Instruction Descriptions
Comment
Task period as TIME data
Task period as LINT data in nanoseconds
Task period as LREAL data in milliseconds
TimeToNanoSec
EN
Intv_tm
In
DIV
EN
ENO
Intv
In1
LREAL#1000000.0
In2
Comment
Task period as LREAL data in milliseconds
ENO
Intv_ns
Intv
2-1377
2

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents