CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Fri Jul 28, 2017 7:36 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed May 17, 2017 8:50 pm 
Offline

Joined: Tue May 02, 2017 10:13 pm
Posts: 1
I am thoroughly befuddled on how to properly read variables out of my Codesys script (located in active application Freewheeling POU) and then write into the software (preferable as a global). It stands to note that the variables are all LREAL. For learning sake (3 wks green), I'd like to know if any solution is dependant on data type.

Current approach is derived from older (2011) posts. {} brackets for emphasis.

Text Field
State Variables -> Texts -> {%2.5f}

At this point I'm getting confused as 'Inputconfiguration' houses options and 'Tap' and 'Toggle' are boolean flags. This leaves OnMouseUp/Down. I get into that editor and loose myself when I try to write or read my globals. Any thoughts or suggestions? This isn't hard, I just don't know where to look.


Top
   
PostPosted: Thu May 18, 2017 12:27 am 
Offline

Joined: Tue Dec 03, 2013 11:52 pm
Posts: 33
I'll attempt to help you out but can't say I fully understand all the questions:

To display your variable on the screen you need to format your element to know what data type it is going to be displaying. If I was to setup a rectangle to display a variable I would first define the formatting sequence in the properties > Texts > Text. The %2.5f would work for the LREAL data type. The different formatting sequences can be found in the help under, CODESYS Visualization > Elements > Generally Configuring Elements > Use Text and Language, in the formatting text section. Now that you have defined what type of variable will be displayed there you will need to define the variable. This can be done in the rectangle properties > Text variables > Text variable.

OnMouseUp/Down can be used to change the value when the object is clicked. For example if I want to increase a global variable by a POU variable when I click the mouse button I would do something like this under Execute ST Code of either the OnMouseUp or OnMouseDown event: GVL.GlobalVarName := GVL.GlobalVarName + POU.LocalVarName;

Hopefully this helps in someway.


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

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


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