Chapter 3. Program Example: 3.1 How To Make Project and Open Program
Chapter 3. Program Example: 3.1 How To Make Project and Open Program
Program example
How to do Programming
3-1
Chapter 3. Program example
Point
If used GMWIN previously, the final working project and program will be open.
3-2
Chapter 3. Program example
Input as the followings in the input column of the generated new project.
3-3
Chapter 3. Program example
Select the type of language for program(LD) from new program dialogue box.
After input the comments for program to the comments column, press [Enter] key or click [Finish] and the screen
below appears.
3-4
Chapter 3. Program example
If variable window appears, input the variable name and click [OK].
Select the type of variable from variable add/modify window and click [OK].
3-5
Chapter 3. Program example
Select from toolbox and click the mouse on the side position of contact.
After selecting the variable type of, click [OK] and the coil will be inputted.
Select from toolbox and click the mouse on the row 1 position of LD window.
3-6
Chapter 3. Program example
After input the variable name (limit switch 1), click [OK].
3-7
Chapter 3. Program example
Select the numeric operation function ADD from function list dialogue box and input the number of input ‘2’ and
then click [OK] to generate the function.
3-8
Chapter 3. Program example
Click [OK]. It shows that variable “ABC” is inputted in the IN1 of function ADD.
3-9
Chapter 3. Program example
Double click the mouse on the IN2 position (row 3, column 1) of function ADD.
If input the constant “1” to the variable input column of variable dialogue box and click [OK], the constant 1 is
inputted in IN2 of function ADD.
3-10
Chapter 3. Program example
Double click the mouse on the OUT position (row 3, column 3) of function ADD.
Input the variable name(ABC_ADD) to the variable input column of variable dialogue box and click [OK].
If select the variable type from variable add/edit window and click [OK], the variable ABC_ADD is inputted in OUT
of function ADD.
3-11
Chapter 3. Program example
If you fail to make execution file due to the occurrence of error, modify the program according to the error message
and then run MAKE again.
3-12
Chapter 3. Program example
3-13
Chapter 3. Program example
If selecting menu [Online]-[Monitor On, ], the user can monitor the action status of program through GMWIN.
3-14
Chapter 3. Program example
3-15
Chapter 3. Program example
How to do Programming
How to register F/B Registers the user F/B to the Project through compile.
How to call F/B Calls the user F/B from the Program.
3-16
Chapter 3. Program example
Input the program file name as above and select the language and program type.
- To make the user defined function, it is required to select the program type Fun and input the language and
function block name.
As the output variable is fixed as ‘OUT’ in the function, it is required to select output data type.
- To make the user defined function block, it is required to select the program type FB and input the language and
function name.
Point
In the user defined function, it is NOT available to select the language SFC.
3-17
Chapter 3. Program example
Add input variable, In/Out variable, output variable. At this time, it is not available to add output variable in the
function.
After completing to add In/Out variable, click [Close] and start to write Program.
Write a program of the user defined function/function block as below.
(Refer to 3.2 how to do Programming)
3-18
Chapter 3. Program example
If the program preparation of the user defined function/function block is completed, select [Compile]-[Compile,
] and start the wizard of the user defined function/function block.
3-19
Chapter 3. Program example
In case of generating new library file, input the library name and click [Next] and start F/FB Wazard.
Click [Finish] and the function block ‘USER1’ is added to the library of project window.
If you want to add the previously prepared library, refer to 4.5.3 Library road.
Point
How to call the source file of the user defined function/function block
◆ To call the source file of the user defined function/function block, double click the
relevant name ( “SPINNING” from the above project window).
3-20
Chapter 3. Program example
3.5.3 How to call the user defined function / function block from the Program
3-21