Beckhoff TwinCAT Frequently Asked Questions (Part8)

 Q: How does TwinCAT determine which week and day of the year a specific date falls on?

A: In the TcUtilities library, there are several functions that can be used to retrieve date-related data:

F_GetMaxMonthDays: Gets the total number of days in a specified month;

F_GetDOYOfYearMonthDay: Gets the day number of a specified date in the current year;

F_GetMonthOfDOY: Gets the month of a specified day in a given year;

F_YearIsLeapYear: Checks if a specified year is a leap year;

F_GetDayOfMonthEx: Gets the day number of a specified day of a specific week in a specified month of a given year;

F_GetDayOfWeek: Gets the day of the week for a specified date;

F_GetWeekOfTheYear: Gets the week number of a specified date in the current year.


Q: How to use the "New Image" option in Beckhoff ScopeView?

A:Please note that the TF7000 version needs to be upgraded to 4.0.2.13.
The new version of the oscilloscope allows adding image variables for observation through the Target Browser, and its setup method is similar to observing regular variables. Actual effect:

Q: How do I generate a tpy file in TwinCAT3?
A: 
  1. Under the project's program settings tab, check the option for TPY File. For specific settings, please refer to the screenshot.

  2. Activate the configuration.
  3. The corresponding tpy file will be generated under the path C:\TwinCAT\3.1\Boot\Plc.
Q: How does TwinCAT3 achieve the merge function for project files?
A:The merge function can be achieved using the TwinCAT Project Compare tool, as shown in the following figure:



The left window displays the editable (modifiable) project, while the right window serves as a reference for comparison. The left and right windows can be swapped using the "switch file" tool in the toolbar. When editing the left window based on the right project, select the desired items to be changed, and then click "accept..." in the toolbar. This will copy (overwrite) the selected content from the right window. After confirming the final changes, click the Save button to complete the merge function of the project. The image below shows the interface after the "accept" action, with the yellow part indicating the copied (overwritten) content:


Q: What do "Separate input update" and "Pre ticks" mean in the TC3 task settings?

A: Checking the "Separate input update" option allows sending a separate data frame for input signals to collect them. The EtherCAT master station will configure an independent data frame to read input process data (this option can be used to reduce input-output response time).

The "Pre ticks" parameter represents the amount of time, expressed as an integer multiple of TwinCAT Base Time, that the sending of the input data frame is advanced compared to the start time of the software task.




    Q: How do I call SFCinit in the Main program when programming with SFC?

    A:

  1. First, enable the flag that is required for SFCInit to be used.
  2. You need to manually create an input variable named SFCInit inside the POU (Program Organization Unit) for SFC programming. Please refer to the screenshot for details


Q: In TwinCAT Measurement, how do I modify the major tick size for the Y-axis?
A: You can modify the Y-Grid parameter within the Axis Group properties to achieve this.




Q: How do I use a trigger in TwinCAT3's ScopeView?

A: A trigger can specify conditions to initiate ScopeView's acquisition tasks: Label, Start Recording, Stop Recording, Stop Drawing, Redraw, Start Exporting Recording, and Stop Exporting.

Among these, Start Exporting Recording and Stop Exporting support a maximum of 5 recordings, but the use of these features requires purchasing and installing a professional license.

Notes:
  1. The trigger conditions need to be added to the datapool beforehand.
  2. The trigger conditions need to be selected in "use data" and must meet the threshold value to be effective.

  3. It is recommended to use multiple trigger groups, for example, one set as "start record" and another as "stop record". If multiple trigger sets are added to the same trigger group, the AND and OR in the combine setting will affect their priority. Using AND for some trigger sets may result in them not functioning as expected.
Q: OPC UA configuration error: "security was not requested but the server does not have any endpoints without security."
A: 

The error occurs because during configuration, the option to allow encryption and its corresponding endpoints was not checked, resulting in the encrypted endpoints being unusable. The solution is to check the "none" option or set it to non-encrypt.


Q: How do I modify the color of comments in TwinCAT3?
A:You can modify the color of comments in TwinCAT3 by navigating to the "tools---options" tab. For specific steps on how to make the changes, please refer to the attached screenshot.

Like my work? Consider a donation! 👇