Using libraries
Overview
This explains the steps for using a library file (*.kubf) downloaded from this site in your project
Procedure
The steps are explained using the ring buffer library (RingBuf.kubf) as an example
1:
Right-click "User Function Blocks" in the toolbox, select Import from the menu, and select the downloaded file
2:
When the file is loaded, a "RingBuf" folder is created under "User Function Blocks" and the RingBufGet and RingBufPut functions are added
3:
Drag the function to where you want to use it in the ladder and import it with [Yes]
4:
When the import is complete, the function is inserted into the ladder
For function blocks
When importing a function block, a dialog for registering the variable name (instance registration) is shown
(e.g. for ModbusTCPClient_Command)
Removing user function blocks
I could not find in the manual how to remove an imported library from the user function blocks,
but deleting the library's folder in the project folder with Explorer removed it
Overview of Function Blocks and Functions
Function
A function's internal code runs when its execution condition is ON
When the internal code finishes, execution returns to the original ladder
Like the MOVE instruction, it runs only at that moment, so you do not need to think about memory inside the function
Function block
A function block's internal code always runs regardless of the execution condition
Because the memory (variables) inside the function block must therefore always be kept, an instance of the function block is created
Each instance is given its own variable name (instance name)
