Function Blocks are modular, reusable pieces of code that encapsulate specific functionality. By importing and incorporating pre-built blocks into your CX-Programmer projects, you can save time, enhance code readability, and ensure consistency across different applications. This guide will walk you through the step-by-step process of importing Function Blocks, and integrating them into your PLC programs.
1.Import Existing Function Blocks
To import an existing function block into your program in CX-Programmer first you must insert custom function blocks into your project using the method below:
- Right click Function Blocks on the left hand menu
- Go to Insert Function Block
- Click From File
4. Next select navigate and select the function block you wish to import:
5. The Function block should now appear in the left hand bar:
2.Using Imported Function Blocks
1.To use the imported function block either press F on your keyboard or click the following button:
2.You will then need to name the instance of the function block:
3.Hit the P key or click the following button in the tool bar to insert parameters into the selected location: