Beckhoff TwinCAT Frequently Asked Questions (Part20)

 Q: Using ADS to directly control IO, controlling IO output with a high-level language, and reading/writing IO through ADS addresses (ADS service on the bus needs to be enabled in TC3)

A: First, obtain the ADS address of the IO:
Enable the ADS service on the bus.




With the ScopeView interface, you can obtain the actual ADS address of the IO. Once obtained, you can use relevant ADS commands to read and write to this address.


Q: Insertion and writing of text files using FB_filetell and FB_fileseek

A: FB_filetell is used to retrieve the current position of the cursor.

FB_fileseek is used to change the position of the cursor, but since the cursor cannot be set to a negative position, the mode FB_FILEOPEN cannot use Fopen_modeappend, which would prevent the cursor from moving forward. 

Example routine is as follows: (The test result shows that the cursor is moved to the instructed position, and any subsequent writing will overwrite content from that point. Therefore, if you want to perform an insertion, you must read the subsequent content, combine it with the current content to be inserted, and then write it.)

fileopen( // Open the file in r+ and t mode, where r+ allows reading and writing while overwriting original content, and t opens in text mode sNetId:= '', sPathName:= 'D:\filetest.txt', nMode:= FOPEN_MODEREAD OR FOPEN_MODEPLUS OR FOPEN_MODETEXT, ePath:= , bExecute:= bopen, tTimeout:= T#2S, bBusy=> , bError=> , nErrId=> , hFile=> hFile); // Get the current cursor position filetell( sNetId:= '', hFile:= hFile, bExecute:= btell, tTimeout:= , bBusy=> , bError=> , nErrId=> , nSeekPos=> tellSeekPos ); // Set the cursor position using SEEK_CUR for relative mode fileseek( sNetId:= '', hFile:= hFile, nSeekPos:= nSeekPos, eOrigin:= SEEK_CUR, bExecute:= bseek, tTimeout:= , bBusy=> , bError=> , nErrId=> ); // Content is inserted at the cursor position filewrite( sNetId:= '', hFile:= hFile, pWriteBuff:= ADR(string1), cbWriteLen:= LEN(string1), bExecute:= bwrite, tTimeout:= , bBusy=> , bError=> , nErrId=> , cbWrite=> ); // Close the file fileclose( sNetId:= '', hFile:= hFile, bExecute:= bclose, tTimeout:= , bBusy=> , bError=> , nErrId=> );

Q: What should I do if the TwinCAT3 seven-day license file appears again after deleting the previous one?

A: As we all know, under the path C:\TwinCAT\3.1\Target\License, TrialLicense.tclrs is the corresponding seven-day license generated after activating TwinCAT3. If this file is deleted and there are still authorizations without a valid license used in the project, the file will be regenerated after activating the project.

If you have confirmed that no relevant authorizations are used in the project (for example, when modifying the original project, the visualization or serial port program is deleted, etc.), and the seven-day license appears again after deletion and activation, please check the library files added under Reference and delete the corresponding library files. After that, the software will not actively activate the corresponding license when activating the project again.

Q: The value is protected by Secure Boot policy and cannot be modified or deleted.
A: Enable test mode using bcdedit /set testsigning yes

Note:

An error occurred while setting element data.

The value is protected by Secure Boot policy and cannot be modified or deleted.

The solution is similar to that for ordinary digital signature installation. Go to BIOS and enable Secure Boot.

Q: Cross-reference table for data types defined in IEC61131-3 and high-level languages such as C#, VB, etc.

A:


Q: TwinCAT Error: EtherCAT SyncUnit Task_10ms (set to OP) >> AdsError 1818

A:

Check if there is an EtherCAT synchronization unit set up. If so, you can try to allocate a separate PLC task for the synchronization unit slave.

Q: TwinCAT3 Icon Not Displaying in the Bottom Right Corner:
I have just installed the latest version of TwinCAT3 (4024.7). All the services are running, and the software operates normally, but the TwinCAT3 icon is not showing in the bottom right corner. What should I do?

A:You can execute TcSysUI.exe in the C:\TwinCAT\3.1\System\ folder to make the icon appear.


Q: How to cancel a license in TwinCAT3?
A: If you have mistakenly selected a license, you can simply uncheck it directly in ManageLicense, as shown in the figure:

If you find that the license cannot be canceled (it is displayed in gray), it must be because related components have been used in the project. Typically, this could be because the corresponding library has been added under References. Locate this library and delete it.

Taking the TF1800 PLC HMI as an example:

Currently, the license is grayed out and cannot be canceled.


Check the PLC project and perform the following steps:

  1. Remove the libraries used by the PLCHMI under the "References" section.
  2. Delete the HMI interface under the "visu" tab.
  3. Delete the "targetvisualization".

At this point, you can uncheck the license in the ManageLicense tab.

Like my work? Consider a donation! 👇