twincat

Why dont the try catch statements work in TwinCAT 4024.7

余生颓废 提交于 2021-01-29 08:40:29
问题 I'm trying the newly implemented try/catch statements which are available since TwinCAT 4024.0. However, I'm getting the following error when compiling: The codegenerator for the current device does not support structured exception handling. Example code (source): FUNCTION F_Calc : LREAL VAR_INPUT pData : POINTER TO ARRAY [0..9] OF LREAL; nElementA : INT; nElementB : INT; END_VAR VAR exc : __SYSTEM.ExceptionCode; END_VAR __TRY F_Calc := pData^[nElementA] / pData^[nElementB]; __CATCH (exc) IF

Defining duty cycle in twincat 3

萝らか妹 提交于 2020-01-05 04:08:06
问题 for a school project I need to connect a temperature sensor to my beckhoff modules and define the temperature. the sensor I am using is an SMT160-30, it works between 1-4khz, which is cutting it close for standard io modules. I will probably need a special input module made for high speed measurements, but according to my teacher I must be able to do it with a standard module. But I am just having trouble with defining the duty cycle and can't really figure out how to solve it. PROGRAM MAIN

How to startup / shutdown TwinCAT System from console / C# program?

断了今生、忘了曾经 提交于 2019-12-23 05:47:14
问题 How could I start/restart/shutdoown TwinCAT System runtime from console or C# application? I need a functionality equivalent to the TwinCAT toolbar buttons System Start/Restart on the lower right. Thanks. 回答1: This can be accomplished be accomplished using the C# .net ADS library. To change the TwinCAT runtime between Config and Run, connect to the System Service ADS port (port 10000) and set the state to AdsState.Run or AdsState.Config . All valid state values can be found here. All the port

Is there a way to print to output console? (twincat3)

冷暖自知 提交于 2019-12-11 14:58:32
问题 Is there a way to print to output to console like debug.print() in VB.NET using structured text? (twincat3) 回答1: You can send messages through ADS commands from TwinCAT code. The function is called ADSLOGSTR. There also also own functions for DINT and REAL, but the STRING function of course can be used with anything. The function has three inputs: msgCtrlMask Mask that describes the message type Types can be found here For example, to show warning message and save it to Windows log:

TwinCAT 3.0 Automation Interface without Visual Studio?

与世无争的帅哥 提交于 2019-12-11 12:06:00
问题 I need to startup/shutdown TwinCAT 3.0 from a C# application. As kindly answered in How to startup / shutdown TwinCAT System from console / C# program? I can use TwinCAT Automation Interface. While in TC 2.0 was possible to simply instantiate Automation Interface with: var systemManager = new TcSysManager(); // missing method exception: // no constructor without parameters defined In TC 3 it gives me the above runtime error. It seems that I need a Visual Studio instance on the PC where I want

TwinCAT: Running on isolated cores failed

旧巷老猫 提交于 2019-12-11 07:33:40
问题 I was trying to activate my configuration on my local PC, but it failed. I tried: Isolate 1 or 2 cores on my pc (Under SYSTEM > Real-Time and reboot the PC) and run the PLC tasks on those cores. When I do this I get the following error: 'TwinCAT System' (10000): Sending ams command >> Init4\RTime: Start Interrupt: Ticker started >> AdsWarning: 4118 (0x1016, RTIME: startup of isolated CPU fails!) << failed! I then tried to run it on the normal windows dedicated CPUs (so none of the CPU’s were

Detect code changes on Beckhoff PLC using C#

拈花ヽ惹草 提交于 2019-12-08 07:53:29
问题 I have a Beckhoff PLC that's running a software developed with TwinCat3. Is there a way to retrieve the running software using C# application ? The TwinCAT.Ads library does not seem to offer such functionality. The plan is to be able to compare what is online with a backup stored locally to detect any unplanned code changes made by Service Technician. It would be enough for me if I could for example retrieve a hash code from the PLC and generate hash from a local backup and see if they match.

Console application not closing

China☆狼群 提交于 2019-12-04 10:05:57
问题 I'm developing a console application that is supposed to run under WinCE 6.0 and WinCE 7.0 . I'm using C# , Compact Framework 2.0 for different compatibility reasons. My application is started by an external runtime called TwinCAT (from Beckhoff). Within this application, my teammate used a function block called nt_startProcess (documentation here) that is in charge of starting my application on demand. My problem - Two different behaviors depending on the OS : When started manually (without