NetLinx Modules
205
NetLinx Programming Language Reference Guide
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.
PROGRAM_NAME='ModuleExampleTest'
(*{{PS_SOURCE_INFO(PROGRAM STATS) *)
(***********************************************************)
(* ORPHAN_FILE_PLATFORM: 1 *)
(***********************************************************)
(*}}PS_SOURCE_INFO *)
(***********************************************************)
(* DEVICE NUMBER DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_DEVICE
dvVCR = 1:7:0
dvTP = 128:1:0
(***********************************************************)
(* VARIABLE DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_VARIABLE
VOLATILE
DEVCHAN dcTRANPORTS[] = {
{ dvTP,1 }, { dvTP,2 }, { dvTP,3 }, { dvTP,4 },
{ dvTP,5 }, { dvTP,6 }, { dvTP,7 }, { dvTP,8 }
}
VOLATILE
INTEGER nVCR_FIRST = 0
FIG. 1
Mainline and Event Table Organization