Beckhoff TwinCAT Frequently Asked Questions and Answers(Part22)

QTwinCAT3  "ambiguous use of name"


A: When encountering such an error, you should consider whether multiple libraries with the same function block names have been included. If it is necessary to keep these libraries, you need to specify the namespace or library name when declaring and using these function blocks, in the format of "library_name.function_block_name".

QIn safety logic, the variable cannot be mapped to a logic variable (goto link variable is grayed out)
A:

  1. First, ensure that the main logic module such as EL6900 is properly recognized.

  2. After creating the relevant variables, rebuild the project.

  3. After rebuilding, ensure that all open task windows are closed.

  4. You can map the variable by reselecting the safety standard variable.

Q: The controller reports an error of insufficient memory, and processes such as PLCHMI cannot be executed

A: Error Message: Failed to start application


A critical component is either missing or is failing to start due to low memory



Solution:

Modify the router memory size in the TwinCAT real-time settings.

Q: An error occurs when TwinCAT3 PLC-HMI is in full-screen mode, stating "The ordinal 149 could not be located in the dynamic link library"
A: 

When encountering the error message in the image, you can copy the corresponding libxml2.dll file from your colleague's computer's C:\TwinCAT\Commem32\ directory to the same directory on your debugging computer. After that, re-activate the configuration and run the PLCHMI's exe file.

Q: How do I add a newline character to a string? Can the data saved in a txt file be on multiple lines?

A: You can add a newline character in a string by using the appropriate symbol, such as \n (in many programming languages). When using the FB_Fileputs function block to write a string to a txt file, you can append \n at the end of each string to ensure that the data is saved in the txt file with each entry on a new line.

Q: too many xml symbols defined

A: In TC2, the number of OPC published variables has exceeded the upper limit of 100,000.

Firstly, use the cleanup function.

You need to select some of the content to be published in the "option" → "symbol configuration" → "set object attributes" menu.

After that, rebuild all.

Q: How to read and write variables using the ADS tag name method (byname) based on variable names?

A: The commonly used ADSread and ADSwrite functions in PLC programs typically interact with data from other devices through offset addresses.

If you wish to interact with data using variable names in a manner similar to handles in high-level languages, you need to add the tcdataexchange (for TC2) or TC2_dataexchange component.

After that, you can utilize the FB_ReadAdsSymByName and FB_writeAdsSymByName function blocks.














If you have confirmed that the parameters are not used incorrectly but still encounter error 1861, you can consider trying a different mode.








Q: How can I change the AMSNetID in the router when it cannot be modified through the usual method? (Changing AMSNetID in the registry)


A:First, set the TwinCAT3 controller to the configuration mode upon startup to prevent it from automatically running upon power-on.
Second, locate regedit.exe and navigate to the registry key "HKEY_Local_Machine\SOFTWARE\WOW6432Node\Beckhoff\TwinCAT3\System". Find the AMSNETID value and modify it accordingly.



Q: TwinCAT2 Error 3252: Size of Stack Exceeds 6144 (_3DDATA_F)

A: Phenomenon: Using TwinCAT2, the program can be downloaded to CX9020 but fails to download to CX5020 with the error message "error 3252: size of stack exceeds 6144 (_3DDATA_F)".

Possible Reasons:

  1. Examining _3DDATA_F, it is identified as a function. Inside this function, there is an array defined as arr: ARRAY [0..20000] OF BYTE;. This large array is the cause of the issue.

Solutions:

  1. Reducing the size of the array will resolve the error.
  2. Alternatively, converting the function into a function block will eliminate this limitation.

Like my work? Consider a donation! 👇