
7.9 FUNCTION GENERATOR Instruction (FGN)
7-23
7.9 FUNCTION GENERATOR Instruction (FGN)
[Outline]
The FGN instruction generates a function curve according to the contents of a previously set
parameter table. The input to the FGN instruction can be integer, double-length integer, or real
number data. The configuration of the parameter table differs according to the type of data.
Table of Integer Type FGN Instruction Parameters
ADR Type Symbol Name Specification I/O
0 W N Number of data Number of pairs of X and Y IN
1 W X1 Data 1 IN
2 W Y1 Data 1 IN
3 W X2 Data 2 IN
4 W Y2 Data 2 IN
… … … … … …
2N-1 W XN Data N IN
2N W YN Data N IN
Table of Real Type FGN Instruction Parameters
ADR Type Symbol Name Specification I/O
0 W N Number of data Number of pairs of X and Y IN
1 W
-
(Reserve) Reserve register IN
2 L/F X1 Data 1 IN
4 L/F Y1 Data 1 IN
6 L/F X2 Data 2 IN
8 L/F Y2 Data 2 IN
…
…
…
…
…
…
2N-1 L/F XN Data N IN
2N L/F YN Data N IN
If the data set in the parameter table for the FGN instruction are X
n
and Y
n
, the data must be set so that
X
n
≦
Y
n+1
. The FGN instruction searches for an X
n
/ Y
n
pair within the parameter table for which X
n
≦X≦Y
n+1
and computes the output value Y according to the following formula:
Y
n+1
– Y
n
Y = Y
n
+
X
n+1
– X
n
× ( X – X
n
) ( 1≦n≦N – 1 )
If the X
n
/ Y
n
pair, which satisfies X
n
≦X≦Y
n+1
for an input value X, does not exist in the parameter
table, the result will be as follows:
•
IF X
<
X
1
Y
2
– Y
1
Y = Y
1
+
X
2
– X
1
( X – X
1
)
•
IF X
>
X
1
Y
n
– Y
n-1
Y = Y
n+1
+
X
n
– X
n-1
( X – X
1
)
Comentarios a estos manuales