CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Fri Jun 23, 2017 4:24 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
 Post subject: __TRY __CATCH questions
PostPosted: Sat May 06, 2017 3:17 pm 
Offline

Joined: Sat Jan 02, 2010 2:05 pm
Posts: 77
Hello all,

I've been using structured exception handling in C and in other high level languages and I'm familiar with it's intended use.

In one big program I'm developing now with TwinCAT 3 I have a problem in which randomly my programming computer gets disconnected from the controller and the controller reverts to configuration mode or simply hangs.

There are plenty of loops and pointers involved and, even I've seen that same program working before... now it fails some times... (I've changed the TwinCAT version).

Given __TRY __CATCH... are there to be able to help the programmer when a loop or a pointer are not working as expected I've tried to put a __TRY clause at the beginning and a __CATCH clause at the end of the main cycle (and of course the __END_TRY at the end), but the same behavior happens.

See page 5 and 6 of the following PSF file: https://www.codesys.com/fileadmin/data/Images/Download/FeaturesAndImprovementsV3.5SP6_en.pdf

Should I activate something to get the SEH working in the controller (a PC)?

And... How I should declare HandleException? Which type does it has?

As always thank you very much.

Joan.

_________________
http://www.robotecnik.com - robots, CNC and PLC programming.


Top
   
PostPosted: Mon May 08, 2017 9:30 am 
Offline
Frequent User
Frequent User

Joined: Wed May 04, 2016 6:00 pm
Posts: 115
Hi Joan.

It works for me as:

Attachment:
Captura de 2017-05-08 10-24-02.png

Attachment:
Captura de 2017-05-08 10-24-20.png


You can found __system.exceptionCode enum on Codesys help.


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Tue May 09, 2017 11:40 am 
Offline

Joined: Sat Jan 02, 2010 2:05 pm
Posts: 77
Thank you Josep M.

It was well implemented (as you did and also as the code in the sample on that linked PDF file).

I have not been able to find information about the enumeration __system.exceptionCode, but by now I think I won't need it.

Thank you again!

_________________
http://www.robotecnik.com - robots, CNC and PLC programming.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited