CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Mon Feb 17, 2020 12:05 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue May 19, 2015 9:06 pm 
Offline

Joined: Mon Apr 13, 2015 5:10 pm
Posts: 4
Ive figured out how to insert a "box" on to a CFC type POU, but after setting it to lets say "TON" I was expecting to see the pins appear.
How do I reset teh box to show the pins? (I use the term reset, as its on the menu when I right click on the box).

I am trying to write a component that allows logic to be written straight to a POU, and I have not foound any documentation on how to do this, so I am making random guesses at the moment.

I am using the following to add the box on the CFC POU

private _3S.CoDeSys.CFCObject.ICFCElement add_cfc_box(_3S.CoDeSys.CFCObject.ICFCImplementationObject2 impl, _3S.CoDeSys.CFCObject.KindOfCall type, string name, string instance, System.Drawing.Rectangle bound)
{
_3S.CoDeSys.CFCObject.ICFCItem4 item = ComponentManager.Singleton.CreateInstance(objects_ids.GUID_CFCBOXELEMENT) as _3S.CoDeSys.CFCObject.ICFCItem4;
_3S.CoDeSys.CFCObject.ICFCElement2 elem = item as _3S.CoDeSys.CFCObject.ICFCElement2;
elem.KindOfCall = type;
// name
_3S.CoDeSys.CFCObject.ICFCText Name = ComponentManager.Singleton.CreateInstance(objects_ids.GUID_CFCTEXT) as _3S.CoDeSys.CFCObject.ICFCText;
Name.Text = name;
elem.Texts.Add(Name);
// instance
_3S.CoDeSys.CFCObject.ICFCText Instance = ComponentManager.Singleton.CreateInstance(objects_ids.GUID_CFCTEXT) as _3S.CoDeSys.CFCObject.ICFCText;
Instance.Text = instance;
elem.Texts.Add(Instance);
// position
item.Bounds = bound;
impl.Items.Add(item);

return elem;

}


Top
   
PostPosted: Tue May 19, 2015 9:27 pm 
Offline
Frequent User
Frequent User
User avatar

Joined: Tue Jun 06, 2006 9:03 am
Posts: 413
I'm just guessing, but maybe you haven't added the standard library to your project yet.
Then the compiler doesn't know about TON yet and doesn't know which inputs / outputs it has.


Top
   
PostPosted: Wed May 20, 2015 2:12 pm 
Offline

Joined: Mon Apr 13, 2015 5:10 pm
Posts: 4
The library is already part of the project. I can add by hand in the editor.
Also, the box I insert, if I double click on it,it correctly shows me information about it being a Timer, so I know the compiler understands what the block is used for.


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: Carlos BarrĂ­a and 3 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