Download Logicmaster 90-70 Programming Software User's Manual, GFK

Transcript
3
Formal Parameters within a Parameterized Subroutine Block
In general, formal BIT parameters are allowed on all contacts, coils, and function block
parameters that allow discrete references (%I, %Q, %M, %T, %S, %G, and %U). Formal
WORD and NWORD parameters are allowed on all function block parameters that
allow register references (%R, %AI, %AQ, %P, %L, and %UR). However, the list
provided on the next page contains several exceptions and restrictions.
Note
NWORDs are used only with Parameterized Subroutine Blocks.
NWORDs allow an array of words to be referenced. NWORD
parameters enforce type checking for DWORD, DINT, and REAL
instructions. To avoid confusion, please read the explanation presented
below.
NWORDs Defined
An NWORD is a number of words passed into and/or out of a Parameterized Subroutine
Block. NWORDs can be treated as WORDs or DWORDs, determined by the way they
are accessed. If you are using DWORD/DINT features, such as MATH or MOVE, you
must set up the array as shown at the bottom of this page.
NWORD parameters are parameters that make up multiple WORDs; i.e., NWORD
parameters comprise an array of WORDs. The size of NWORDs is specified in WORDs,
not DWORDs. NWORD parameters may be used on any multi-word operands, but
NOT on discrete type parameters.
When to Use NWORD Parameters Rather Than WORD Parameters
If you are using floating point math or if your Parameterized Subroutine Block (PSB)
function requires multi-WORD-oriented reference types, use NWORD parameters.
WORD parameters allow discrete references (e.g., %I, %Q, etc.); NWORD parameters
do not allow discrete references.
Using NWORDs
Within a Parameterized Subroutine Block, the first word of an NWORD parameter
would be referenced by X1[1], for example. The second word would be referenced by
X1[2], etc.
If you want to pass DWORD parameters into a Parameterized Subroutine Block, you
must use the NWORD parameter type. The first DWORD would be referenced by X1[1]
(same as for word). However, the second DWORD would be referenced by X1[3]; the
third by X1[5], etc.
NWORD
NWORD
NWORD
NWORD
NWORD
NWORD
3-98
Parm X1[1]
Parm X1[2]
Parm X1[3]
Parm X1[4]
Parm X1[5]
Parm X1[6]
Logicmaster
First WORD
First DWORD
Second WORD
Third WORD Second DWORD
Fourth WORD
Fifth WORD
Third DWORD
Sixth WORD
t 90-70Programming Software User’s Manual – June 1998
GFK-0263G