independent of the CPU。
(5) Provide appropriate status information from the independent circuits to the FX2N so that
the program and any operator interfaces have necessary information。
(6)Identify any other safety-related requirements for safe operation of the process。
Specify the Operator Stations
Based on the requirements of the functional specifications, create drawings of the operator stations。 Include the following items:
(1) Overview showing the location of each operator station in relation to the process or machine
(2) Electrical drawings with the associated I/O of the FX2N CPU or expansion module
Create the Configuration Drawings
Based on the requirements of the functional specification, create configuration drawings of the control equipment。 Include the following items:
(1) Overview showing the location of each FX2N in relation to the process or machine
(2) Mechanical layout of the FX2N and expansion I/O modules (including cabinets and other equipment)
(3) Electrical drawings for each FX2N and expansion I/O module (including the device model numbers, communications addresses, and I/O addresses)
Create a List of Symbolic Names (optional)
If you choose to use symbolic names for addressing, create a list of symbolic names for the absolute addresses。 Include not only the physical I/O signals, but also the other elements to be used in your program。
Basic Elements of a Program
A program block is composed of executable code and comments。 The executable code consists of a main program and any subroutines or interrupts routines。 The code is compiled and downloaded to the FX2N; the program comments are not。 You can use the organizational elements (main program, subroutines, and interrupt routines) to structure your control program。
Main Program
The main body of the program contains the instructions that control your application。 The FX2N executes these instructions sequentially, once per scan cycle。
Subroutines
These optional elements of your program are executed only when called: by the main program, by an interrupt routine, or by another subroutine。 Subroutines are useful in cases where you want to execute a function repeatedly。 Rather than rewriting the logic for each place in the main program where you want the function to occur, you can write the logic once in a subroutine and call the subroutine as many times as needed during the main program。 Subroutines provide several benefits:
(1) Using subroutines reduces the overall size of your program。
(2) Using subroutines decreases your scan time because you have moved the code out of the main program。 The FX2N evaluates the code in the main program every scan cycle, whether the code is executed or not, but the FX2N evaluates the code in the subroutine only when you call the subroutine, and does not evaluate the code during the scans in which the subroutine is not called。
(3) Using subroutines creates code that is portable。 You can isolate the code for a function in a subroutine, and then copy that subroutine into other programs with little or no rework。
Interrupt Routines
These optional elements of your program react to specific interrupt events。 You design an interrupt routine to handle a pre-defined interrupt event。 Whenever the specified event occurs, the FX2N executes the interrupt routine。 The interrupt routines are not called by your main program。 You associate an interrupt routine with an interrupt event, and the FX2N executes the instructions in the interrupt routine only on each occurrence of the interrupt event。
Tip
Because it is not possible to predict when the FX2N might generate an interrupt, it is desirable
to limit the number of variables that are used both by the interrupt routine and elsewhere in the program。 Use the local variable table of the interrupt routine to ensure that your interrupt routine uses only the temporary memory and does not overwrite data used somewhere else in your program。 There are a number of programming techniques you can use to ensure that data is correctly shared between your main program and the interrupt routines。