Technically, modules can contain declarations to other modules, provided that no circular references are
involved. However, because different instances of the same module must not be separated by instances of
a different module, it is highly recommended that you do not declare modules from within other modules
- if you have multiple declarations of the parent module they will then be separated by the declarations of
the child module.
FIG. 1 demonstrates how a NetLinx module is incorporated into a main program. In this example, the
main program has no event table or mainline code.
FIG. 1
Mainline and Event Table Organization
PROGRAM_NAME='ModuleExampleTest'
(*{{PS_SOURCE_INFO(PROGRAM STATS)
(***********************************************************)
(*
ORPHAN_FILE_PLATFORM: 1
(***********************************************************)
(*}}PS_SOURCE_INFO
(***********************************************************)
(*
(***********************************************************)
DEFINE_DEVICE
dvVCR
dvTP
(***********************************************************)
(*
(***********************************************************)
DEFINE_VARIABLE
VOLATILE
DEVCHAN dcTRANPORTS[] = {
VOLATILE
INTEGER nVCR_FIRST = 0
NetLinx Programming Language Reference Guide
DEVICE NUMBER DEFINITIONS GO BELOW
= 1:7:0
= 128:1:0
VARIABLE DEFINITIONS GO BELOW
{ dvTP,1 }, { dvTP,2 }, { dvTP,3 }, { dvTP,4 },
{ dvTP,5 }, { dvTP,6 }, { dvTP,7 }, { dvTP,8 }
}
NetLinx Modules
*)
*)
*)
*)
*)
205