How to identify and log errors from Function Blocks
Introduction
By default, most of the Function Blocks found within Sysmac Studio, have an error output bit associated with them. Motion control, SD Memory Card, and Communications Function Blocks, are all great examples which could produce an extensive range of errors that can be difficult to troubleshoot.
Frequently we see these kinds of function blocks implemented, yet output variables such as Error, Error ID, and Busy, are often omitted since they are not required to compile the program, and they can be viewed via watch tab.

Additionally, implementing logic in your program to handle all of these error bits can become tedious. Particularly if you are communicating with multiple devices over multiple protocols, or, executing motion control across multiple axes.
Solution
This is where Instruction Error Output Setting comes to use. This setting allows you to log errors that occur from a Function Block within your Sysmac Studio Project.
Prerequisites
• A CPU Unit with unit version 1.02 or later is required to create events for instruction errors.
• A CPU Unit with unit version 1.02 or later and Sysmac Studio version 1.03 or higher are required to specify whether to output instruction errors when they occur.
Precautions for Correct Use
• To create events for instruction errors, you must select Use for Event Log Settings − Instruction Error Output on the Sysmac Studio. Refer to 4-2-2 Controller Setup on page 4-4 and to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for information on the Controller Setup.
• If you change the user program after an instruction error occurs, the information in the event log may no longer be correct.
• If an instruction with an error is executed repeatedly, an instruction error or event is created each time the instruction is executed. This may cause the event log to exceed the maximum number of events. If this occurs, older events are overwritten.
• The troubleshooter may not specify which instance of the function block has produced the error. If multiple instances of a function block are used, you will still need identify which instance is causing the error. This can be achieved implementing the associated function block error bits as part of the error checking/ alarms section of your program.
To enable the function.
- Navigate to Controller Setup → Operation Settings → Basic Settings → Event Log Settings.
- Check the “Use” box.
- Transfer the settings to the controller.

How can I check the Error log?
- Go online to the controller.
- Open the Troubleshooting Dialogue box, as you would when normally checking for controller errors.
- Click on the “Controller Event Log” tab.
- Select “Update”

Review the error log. under the “Source Details” column, look for any entries that are labelled “Function Error”. These are the entries added from instruction errors.
Information from the error log.
Example 1
This example shows an instruction error where an error has occurred from executing multiple instances of an instruction simultaneously. This won't cause an error in the PLC, and the instruction will not complete.
The attached information lets us know that this is occurring in program 0, at the instruction ResetECError.

Example 2
This example shows a function error which has occurred in an FTPGetFile function due to one of the input parameters being out of the valid range.
What's interesting in this example is that the error location is “FunctionBlock0”.
This example is produced from executing a user custom function block, which contains the FTPGetFile function.
You can use the Instruction Error logging function to troubleshoot your own custom function blocks!
