Question and anwser about Beckhoff twincat 2 |Frequently encountered problems during the learning process of twincat2

 Q: What is the full name of TwinCAT?

 

A:The Windows Control and Automation Technology






Q: What does the different color of TwinCAT icon mean?

 

A: Different colors of TwinCAT icons indicate different states of the TwinCAT system.

Before the user logs in to the system, Windows NT starts the TwinCAT System service and generates an icon on the taskbar as the TwinCAT activity identifier:

Red - indicates that TwinCAT is in stop mode

 

Blue indicates that TwinCAT is in configuration mode Yellow indicates that TwinCAT is starting

Green - indicates that TwinCAT is in the running mode.

Q:What is  source code download?

  A: The source code download function allows you to save the program source code (including comments) to the controller, so that users can directly obtain the program 


source code from the controller in the future for maintenance and troubleshooting purposes.

Q: How to start the PLC and run the program?

 

A: You must create a self-starting project: log in and the program has been downloaded, TwinCAT is in Run mode. Select "Create Boot Project" from the "Online" menu bar, as shown below:



Q: How can PLC variables be associated with actual IO channels?

 

A: After the PLC program is compiled, a file with a suffix of tpy will be generated. When the file with a suffix of tpy is added in TwinCAT System Manager, the variables can be connected to external IO, as shown in the figure below.




Once the PLC program is added, double-click the variable, and a connection variable interface will pop up. In this interface, there are external IOs that can be connected to the variable.





Q: Can the PLC program execute system function commands such as shutdown and restart of Windows?

 


 A: By adding the TcUtilities.Lib library file (adding this library file will automatically load the three library files of Standard.Lib, TcBase.Lib, and TcSystem.Lib), multiple function blocks or functions can be called to execute relevant Windows operating system function commands. Listed below:

Name

Describe it

NT_Shutdown

Shutdown the operating system

NT_AbortShutdown

Cancel the shutdown of the operating system command

NT_Reboot

Restart the operating system

NT_GetTime

Get the local system time

NT_SetLocalTime

Set the system time of the computer

NT_StartProcess

Start a Windows application

NT_SetTimeToRTCTime

Synchronize local system clock with PC real-time clock

FB_RegQueryValue

Read the system registry

FB_RegSetValue

Write system registry

FB_EnumFindFileEntry

Search for subdirectories or files under the folder that match the specified file name

FB_EnumFindFileList

 

Search for subdirectories or files under the folder that match the specified file name, and

List the objects found one by one

 

FB_GetAdaptersInfo

Read the card information of the local or remote PC

FB_GetHostName

Read the hostname of the local or remote PC

FB_GetHostAddrByName

Convert host name to IP address (IPv4)




  

Q: When is System Manager in a mode that can diagnose the input and output status of the IO module?

 

A: System Manager  in  Free Run mode


If you are in RUN mode, it is green and displays Run

If in Free Run mode, it will flash between Config and Free Run states

Q: How to force output after scanning the IO?

 

A: Successively expand the fieldbus master station, a node under the master station, terminals, and until a certain channel of the terminal.


Select "Write" and click "1", you will see the output value change to high (1) in the monitoring diagram and the LED on the corresponding channel of the KL module will 



light up.


Q: How to solve the problem that TwinCAT Broadcast Search cannot find the controller?

 

A: First try pinging the controller to see if it can be pinged. If it cannot be pinged, you must check whether the two communicating parties are on the same network segment. If TCP/IP is working, then simply enter the object's IP address or CX name and connect. This usually works in most cases.

 

 

Q: What is the purpose of the TwinCAT PLC programming interface shown in the figure?

 

A: It is the place to define program variables.


Q: When I write a ladder diagram program, whenever I define/name a contact, the software will pop up a dialog box. What is this dialog box used for?

 

A: This is an automatic definition dialog box, through which you can name variables, specify variable types, assign variable addresses, assign initial values, and also add comments to variables.


Q: What is the TwinCAT delayed start method?


A: In some cases, our customers may request a delayed start of our TwinCAT service (for example, I encountered a customer who communicates with our device using a USB-to-network port, but the service for the USB-to-network port starts relatively slowly, causing our TwinCAT communication to be disconnected when the TwinCAT System Service is just starting up). The customer requested that we avoid this problem.

In XP system, all service items can only be in 'start' and 'stop' states, and cannot be set with a specific delay time as in Win7.

There are two ways to solve this problem in XP system:

1. Some international customers have used third-party software and detected that the necessary services have been started before starting the TwinCAT System Service service item (set the TwinCAT System Service service item to manual).

2. Modify from the registry, open the 'Start' menu -> 'Run' -> enter 'regedit'

->HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcRTime->

Right click on TcRTime and create a new 'multi-string value' -> Name it 'DependOnService'

-> Fill in the name of the service that needs to be started first in the data value. This allows you to implement the corresponding delay service in XP systems.

 

Here is a screenshot of the example I created using the second method:


Click it to display, click "Run" and enter click "Confirm". Now you are in

Registry editing interface


Follow this path

->HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcRTime  find TcRTime

As shown in the figure below, right click TcRTime,


Select New -> Multiple String Values,


Rename the New Value #1 to DependOnService.


Assumption: The Messenger service must be started first, so my DependOnService data is 'Messenger'



This completes the setup. To test the correctness of this setting, I first disabled the service item Messenger that I was testing.

If you cannot stop the service, please stop the TwinCAT System Service first, and then try to stop this service

Then restart the computer.

At this time, you can find TwinCAT in the lower right corner of the desktop

The service has not been started. If you directly start Twincat, an error will appear as follows


If you run the service item Messenger first.


 

TwinCAT service can be run

In this case, the dependent service must be started first before the TwinCAT service can be started


The service item that is being relied on must be available in the 'Administrative Tools' -> 'Services' of the computer. Figure:

 



Q: What is the problem with the output flashing after setting the digital output to true? A: The reason is that the task period is set too long. It is recommended to set it to less than 100ms.

 

 

Q: If a terminal module of Beckhoff fails and is replaced (even with the wrong model), will the PLC program still run?

A: The PLC program will still run.

 

 

Q: After forcing the digital output, will the original value be restored by re-running the program (after stopping) or re-powering on?

 

A: Rerun the program (stop and then run again) and the forced value will still be maintained. After powering up again, the output will be determined by the PLC program.

 

 

Q: If the IPC executes a dead loop, can we still connect to it? A: No, if you want to prevent the system from running away, please set a watchdog.

 

Q: How to add the EL3318 thermocouple module to SystemManager (how to add a new module to an old TWINCAT version)

 

A: Install a new version of TWINCAT or download the latest XML file

 

 

Q: How to ensure that the TwinCAT system automatically starts after entering the operating system

 

A: Generally, we can achieve automatic startup of TwinCAT by setting the Auto Boot function in the System tab of TwinCAT properties, as shown below


However, if the operating system does not start normally (such as power failure), TwinCAT may no longer automatically start when the system is restarted next time. To ensure that TwinCAT can still automatically start in such cases, the following methods can be used:

Open the registry file (Start->Run... and enter the command Regedit), create a new Dword value "ForceSysAutoStart" in "HKEY_LOCAL_MACHINE\SOFTWARE\BECKHOFF\TwinCAT\System", and set its value to 1.

 

How to print the image in Visualization?

A: In Visualization, the current screen can be printed by executing the Print command in the input of the control.

 

 

Q: How to configure IO in SystemManager?

 

A: There are several ways to achieve this. The most common method is to directly 'Scan Devices' in System Manager. To achieve this, first create a new TwinCAT System manager and then follow the steps below:

Note:

If a remote connection is required, it is necessary to establish a connection with the remote device first.

1. Right-click on "IO devices" in System manager and select "Scan Devices".

 

 


2. Select 'OK' and scan the fieldbus master.


3. Select the fieldbus to be scanned, click "OK", and then select "Yes" to scan the module.


4. Select the module you want to use.



2. Select "Yes" to activate Free Run, and then debug IO


Q: I often cannot broadcast the screen CP6701-0001-0020 with TwinCAT. I can ping it, but I cannot broadcast it.

 

A: Don't set the two network cards in the same network segment. For example, set the static IP 192.168.0.1 for the rear network port, and set the other network port to 169.254.xxx.xxx

 

 

Q: After downloading the program, the program does not run. Why is this?

 

A: After downloading the program, you need to set the TwinCAT PLC to Run mode before the program can run. A common mistake is logging in and downloading the program, but forgetting to set the TwinCAT PLC to Run mode.

Q: What functions can diagnose that the actual task cycle time is greater than the preset time?

 

A: You can set the watchdog function of the bus terminal module to detect actual cycle time greater than the preset time.


The watchdog will raise an alarm after 100ms if the module does not receive valid process data from the controller within the preset time.

The Watchdog function can be activated using the KS2000 or via TwinCAT. For Profibus bus, this function can be set in the Porfibus master station.

 

Q: How to add function blocks in ST language and ladder diagram? A: There are two methods in ST language:

Method 1: Press F2 on the programming area with the cursor to pop up a dialog box, and select the required function block in the dialog box.

Method 2: Activate the programming area, click "Insert" in the menu bar, select "Function Block..." and a dialog box will pop up. Select the required function block in the dialog box.

In ladder diagram, there are three methods:

Method 1: Activate the programming area, click "Insert" in the menu bar, select "Function Block..." and a dialog box will pop up. Select the required function block in the dialog box.

Method 2: Activate the programming area and select the "Function Block..." icon in the toolbar. Method 3: Right-click in the programming area and select "Function Block..."

 

Q: What should be noted when adding routes to TwinCAT? A: 1. Windows Firewall Settings:

1. When performing network settings, you should turn off the Windows Firewall, otherwise communication may be blocked. Control Panel => Windows Firewall, turn off the Windows Firewall.

2. In addition to the Windows Firewall, other firewalls such as Kingsoft Antivirus and 360 Security Guard should also be closed.

 

2. IP address settings:

Modify the IP addresses of the IPC and the computer to be in the same network segment.

Open the connected network status panel, click "Properties", select TCP/IPv4, and click Properties.



Modify the IP address of the controller and the computer to be in the same network segment, and click OK.

The default IP for the BC90xx is 172.16.17.X, where X is determined by the dip switch. The default IP for the BX9000 is 172.16.21.20


The default IP for CX is automatically obtained. If there is no DHCP server in the network, it is usually 169.254.X.X.

 

2. Modify the TwinCAT AMS NET address:



 1. Right-click the TwinCAT icon in the taskbar and select "Properties"

Fill in different AMS addresses in the "AMS Router" tabs of the controller and computer, keeping the last two digits as ".1.1".


(If the AMS Net ID is 127.255.255.1.1.1, it must be modified as this is the default address of the system and is likely to cause address conflicts)


4. Account and password for XP and CE when adding route

1. Right-click the TwinCAT icon in the taskbar and select "System Manager". 2. Select "Choose Target" in "SYSTEM-configeration".



Select "Search (Ethernet)" to search for the controller.


4. Click "Broadcast Search" to search for controllers in the WLAN, and select the corresponding controller


(In this example, it is CX-0E1E46), select the "IP Address" mode, and click "Add Route". After the connection is successful, the corresponding "X" symbol will be 


displayed under the "Connected" column (as indicated by the arrow in the figure).

5. After searching for the controller and clicking "Add Route", you need to enter your account and password, as shown below:


The default account for XP systems is Administrator, with a password of 1.

The default account for the CE system is Administrator, with no password, and simply clicking "OK" will work.

 

 

 

Q: After installing Tc211x64Engineering_R3_2.11.2230 on a 64-bit operating system, I cannot switch from LOCAL to run mode.

 

A: TwinCAT 2 does not support 64-bit systems. This software only supports the native machine as a programmer for programming CX OR IPC. The native machine cannot switch to run mode.