Twincat endless loop..

Pergo

Member
Join Date
Jul 2014
Location
Hamina
Posts
5
Hello,


CX9020 gets stuck after about two seconds after booting. Mouse pointer stops, won't allow access through system manager (timeouts) or web config. Won't answer to ping.
I suspect the culprit is the autostarting program I wrote which causes infinite loop. ?

I'm complete newbie so I don't have that much experience on normal Twincat behaviour. Any ideas are welcome.


-Pergo
 
I've used this PLC kind time ago, it worked like charm, it had a problem with VISU and NC, which was unable to handle but this is another story...

If your device comes with Windows CE xxx or any embedded compact windows version then follow those steps:

Any PLC makes an infinite loop by default. If you add another one there and you need the PLC to be deterministic and to complete a cycle loop each n milliseconds then... you can imagine it... apocalypse happens... (This happened to me a lot of years ago... in my case I was coming from the IT world and placing a "while (true)" loop looked perfectly acceptable (of course the controller had other ideas).

The only options here are to remove the complete folder where the PLC project has been stored. You can do it by removing the media card from the PLC and deleting the Documents folder.

In order to do that:

1. Stop and unplug the PLC.
2. Remove the card.
3. Delete that folder from any explorer in your PC, phone...
4. Put the card back into the PLC.
5. Start the PLC again.
6. Wait for it to restart a couple of times (it will create the folder back).
7. Start again with all the modifications, parameters and so...

You are ready.

Don't add a WHILE (TRUE) or similar loop...
You can loop of course and this (given the amount of power on those devices will work for you) but you have to check how much cycle time is that loop consuming in order to ensure each cycle is processed correctly.
Imagine you have to loop through 100 elements in one array and with each element you plan to make an operation that takes 2ms (My imagination is really bad).
If you have a 10 ms cycle time my recommendation would be to make only 4 steps of that loop in each cycle... you are making the process 4 times faster by looping and keeping the PLC running as expected.

Good luck!
 
I've used this PLC kind time ago, it worked like charm, it had a problem with VISU and NC, which was unable to handle but this is another story...

:) I guess I'm walking on almost same path here. I've now found out that also visualization (which is supposed to run in CE) will cause immediate timeout on system manager. Simple visu, consisting of one button and one textfield seems to work perfectly, though. I've already dropped task priority on VISU/VISU INPUT tasks, made their and main task cycle times a lot longer, dropped base time to (none).

I'll call Beckhoff tomorrow to get a reality check on for what this plc is really capable of or which is more likely, I've got some newbie mistake happening here. ;)



If your device comes with Windows CE xxx or any embedded compact windows version then follow those steps:

Any PLC makes an infinite loop by default. If you add another one there and you need the PLC to be deterministic and to complete a cycle loop each n milliseconds then... you can imagine it... apocalypse happens... (This happened to me a lot of years ago... in my case I was coming from the IT world and placing a "while (true)" loop looked perfectly acceptable (of course the controller had other ideas).

Same experience here. I admit I was a little bit stoked on IEC61131-3 while getting familiar on the concept. Smooth transition to plc world was expected. Seems there is no free lunch after all. :D


The only options here are to remove the complete folder where the PLC project has been stored. You can do it by removing the media card from the PLC and deleting the Documents folder.

In order to do that:

1. Stop and unplug the PLC.
2. Remove the card.
3. Delete that folder from any explorer in your PC, phone...
4. Put the card back into the PLC.
5. Start the PLC again.
6. Wait for it to restart a couple of times (it will create the folder back).
7. Start again with all the modifications, parameters and so...

You are ready.

I'll try this. I guess I stumbled on this file creation on first boot thing while trying to find out how to get the DVI resolution lower. Currently it's 1920x1080 and I'd like to test if there was any performance gain available with lower resolution. I changed the resolution from cx config but it gets back to lcd resolution after boot. I've even tried those register patch files that allow for resolution/bpp change. Checked even registry that values are altered but everything gets back to normal after reboot. Tried to save resolution and reboot while screen disconnected.
I remember it was mentioned somewhere that at least CE registry is generated from scratch on first boot, just as you described.


Don't add a WHILE (TRUE) or similar loop...
You can loop of course and this (given the amount of power on those devices will work for you) but you have to check how much cycle time is that loop consuming in order to ensure each cycle is processed correctly.
Imagine you have to loop through 100 elements in one array and with each element you plan to make an operation that takes 2ms (My imagination is really bad).
If you have a 10 ms cycle time my recommendation would be to make only 4 steps of that loop in each cycle... you are making the process 4 times faster by looping and keeping the PLC running as expected.

Good luck!


Thank you very, very much for your tips. On many other forums, this kind of newbie question would have been flamed to smoking pile of charcoal immediately.
I hope I will be able to contribute in similar way on this forum in the future.


-
 
Hello,


CX9020 gets stuck after about two seconds after booting. Mouse pointer stops, won't allow access through system manager (timeouts) or web config. Won't answer to ping.
I suspect the culprit is the autostarting program I wrote which causes infinite loop. ?

I'm complete newbie so I don't have that much experience on normal Twincat behaviour. Any ideas are welcome.


Sorted this out just like Joan Murt suggested, by removing \TwinCAT\Boot folder. Contacted also Beckhoff Finland on timeout issue. Seems that I've got my network connection fckd up. I've got my EK1100's connected to X001 (second ethernet port on 9020) instead of EK1110 (EtherCAT extension module to be connected as last of the io modules). This causes excessive network packet traffic on X000/system manager line which -I guess- halts system manager that tries to cope with plentiful incoming ECAT packets.

Got to wait those EK1110:s but still happy because there is now a logical reason for the behaviour. Display problem still persists. Won't allow for lower resolution than lcd native 1920x1080.


How come it seems that there is a trend on first posts to this kind of forums: 'Hello, I've got a project, with a deadline, with a system that I have no experience whatsoever. Please help!' ;)



-
 
Just in case it would help you in terms of resolutions, see a small tip I wrote time ago in another forum. I wrote that there as a resource to find easily how to do it when needed...

See: http://www.codeproject.com/Tips/655815/How-to-Change-the-Display-Resol

You will see lot's of small differences. The best part of it is that if you come from the programming world the ST editor will not be a problem for you and that you will be familiar with all the topics regarding object oriented programming and so that come with the new TC3, I was doing some kind of emulation of that OOP in TC2 and I'm ultra-glad they've implemented it at the end.

Yes, there are kinds of questions that start flamewars and other exotic community behaviors, but at the end yours was a perfect question that has nothing to do with those "I want somebody to past a code that works to make XXX".

I'm glad those mini-tips have helped you... happy programming! (y)
 
Banging head to the wall. Hard. :]

What would be the reason for fail here: I have a program that flashes a single output (O1:=NOT(O1);, cycle time increased so that MAIN is executed once pre second. Flashing shows ok in system manager online scope (Actual output, address/link is correct, presented as O1 AT %QX26.0:BOOL; ) but nothing happens on physical output. Anyhow, I'm able to force that output on/off and led/output works like it should.

This is very promising phase though. Network packet traffic was cut to below 10% after installing EK1110.

Reinstalled contents of the SD card (found same version from beckhoff ftp). That was the last solution after reinstalling TwinCAT to two separate laptops and doing a plethora of other 'restart from clean table' -procedures. Works fine now. I can't find any logical connection to any action that could have caused the behavior. Wouldn't accept 'Activate configuration' on System manager: ADS error 1804, also performed similarly with a clean installed laptop, which lead me to think the problem might still be in 9020. Which was supposedly factory reset at 9020 web config. As it worked right away after swapping the SD card, it clearly wasn't.

Steepness of this learning curve lets me believe there is a possibility it's actually a wall. :rolleyes:


-
 
Have you done all the job in the System manager stage?

It looks like you've not linked the variable to the physical world...
 
Have you done all the job in the System manager stage?

It looks like you've not linked the variable to the physical world...


Sorted this out with help from Beckhoff support. (y) for them.

Problem was that the ultimasimple solution for testing/flashing (Cycle time to 500ms) was too slow for io to update properly.

Lesson learnt: Do not stick to the simplest method for testing you can think of at the moment. There is even simpler method available with less variables. Which usually works.


-
 

Similar Topics

I am using twincat 3 to send some strings over TCP/IP. Where the server is a sensor and my PLC is the client. I noticed that the sensor didnt...
Replies
2
Views
93
I'm trying to control a device via MODBUS RTU and the ModbusRtuMasterV2_PcCOM in Twincat 3. I've configured a device with the right com port and...
Replies
7
Views
228
Hi! I am trying to run the 'SimpleSample' (https://infosys.beckhoff.com/content/1033/TF5100_TC3_NC_I/Resources/3438746891/.zip ) to understand the...
Replies
2
Views
114
I am developing a library in twincat and one of the function uses IID_ITcVnAccess_TcVnPoint2_DINT and the definition of this type is defined in...
Replies
0
Views
76
Sorry if this has been asked before, and apologies if this seems like a trivial issue, but I am new to Beckhoff and have been banging my head...
Replies
2
Views
160
Back
Top Bottom