Post by ph0010421 on TCP/IP client
CODESYS Forge
talk
(Post)
Hello TCIS_Send needs to be longer than 4 bytes because idata is 28 bytes long. There may be other ways, but I would make a UNION with string/array of bytes. Write your STRING into the AsString part then copy the AsBytes part into TCIS_Send (Elements [3] to [30]) then 252 would be in [31] (I've assumed the idata is always the same length)
Last updated: 2023-12-19
Post by timvh on FB string and naming
CODESYS Forge
talk
(Post)
Really not clear what you are trying to do, but isn't a Struct enough? So add an object of the type DUT to the Application. Then create a structure TYPE ST_Sensor : STRUCT sName : STRING; uiNumber : UINT; END_STRUCT END_TYPE Then in you application add an instance of this Structure stSensor1 : ST_Sensor := (sName := 'my sensor', uiNumber := 1); or use it like this stSensor1.sName := 'my sensor';
Last updated: 2024-09-28
Post by bertcom on Converting each character to a string into ASCII
CODESYS Forge
talk
(Post)
@TimvH, Thank you, i think this way i can seperate the complete string to characters. Next part of the topic is converting the characters to an ASCII code. Is there an standerd function in Codesys for this? I alredy searched a few hours for it on the internet. no succes.
Last updated: 3 days ago
Post by ph0010421 on How to create a stopwatch?
CODESYS Forge
talk
(Post)
Do you need an 'hours-run' counter? And 1 second resolution is ok? I think you're over-thinking it. (The task time needs to be < 1second) Have a look at the LAD... Then, the time in seconds can be made into hh:mm:ss with this FUNction Declarations: FUNCTION funSecondsToStringTime: string VAR_INPUT InSeconds: UDINT; END_VAR VAR AsString: STRING; Minutes: UDINT; Hours: UDINT; Seconds: UDINT; MinutesAsString: STRING(2); HoursAsString: STRING(2); SecondsAsString: STRING(2); END_VAR and the code: Hours := InSeconds / 60 / 60; //Derive hours Minutes := (InSeconds - (Hours * 60 * 60)) / 60; //Derive minutes Seconds := InSeconds - ((Hours * 60 * 60) + (Minutes * 60));//Derive seconds HoursAsString := UDINT_TO_STRING(Hours); MinutesAsString := UDINT_TO_STRING(Minutes); SecondsAsString := UDINT_TO_STRING(Seconds); IF LEN(HoursAsString) = 1 THEN HoursAsString := CONCAT('0',HoursAsString); END_IF; IF LEN(MinutesAsString) = 1 THEN MinutesAsString := CONCAT('0',MinutesAsString); END_IF; IF LEN(SecondsAsString) = 1 THEN SecondsAsString := CONCAT('0',SecondsAsString); END_IF; AsString := CONCAT(HoursAsString, ':'); //assemble string AsString := CONCAT(AsString,MinutesAsString); AsString := CONCAT(AsString,':'); AsString := CONCAT(AsString, SecondsAsString); funSecondsToStringTime := AsString;
Last updated: 2023-12-08
Post by captaincookie on increase default string length in queue
CODESYS Forge
talk
(Post)
Hello, I'm using Codesys V3.5 SP18 Patch 4. In the ElementCollectionExample Project from Codesys, I test the SimpleQueueExample in a Control Win V3 x64 environment. I try to add a string of 95 characters length to a queue. The default length of strings is defined as 80 characters. In the initialization of a string variable, it is possible to increase the length by the definition of e.g. STRING(1000). But when I write the string defined like this to the queue, only 80 characters are written to it and the rest is missing. I think the default length is still set in the queue definition, so it is necessary to change this, isn't it? Is there any option to increase the default length of strings in the queue? Attached you can find the used project. Thanks in advance. If any information are missing or my description unclear please let me know.
Last updated: 2023-10-05
Post by andrebrandt on FB string and naming
CODESYS Forge
talk
(Post)
Hi Tim. Not quite correct. What i'd like, is when you place the FB in prog, i choose a block NTC10k, and name this RT401. What i'm trying to do, is to get the name RT401 automaticly into the FB, so i can put this into the string i pass in a struct. So in var in POU, i saw this a place i could do this, RT401: NTC10k(Tag:='RT401'), but i can't get this to work. I shurly must have had something like this in FB: FUNCTION_BLOCK NTC10k String TAG But it's here where I'm stuck...
Last updated: 2024-09-30
Post by struccc on HTML5 Controls - string(>80) values
CODESYS Forge
talk
(Post)
Dear all, does anyone have experience with HTML5 controls recently? CODESYS 3.5.20.30 / Visualization 4.6.0.0 I'd like to create a simple lightweight text editor, with proper multiline handling, cut & paste, scrolling, etc. And it seems to work fine, just have problems with strings longer than 80 bytes.... Declaring a variable sText1 : STRING(8000) and referencing it in the HTML5 Controls corresponding value property works perfectly one way: the code receive the data as a string (See log1)... (Note TypeID 1000...) Also sending back the data (seems to work (See log2) except it doesn't change the value of the bound variable. Probably the issue is with using SendSimpleValue method... Naturally, I could do a workaround, but maybe there is a more standard way to implement this... Please let me know if you have any suggestions.
Last updated: 2024-10-23
Post by manuknecht on Specify Input Configuration "OnDialogClosed" Action to only react to certain Dialogs
CODESYS Forge
talk
(Post)
I have a project with several buttons and dialogs. Most of the dialogs are opened using the Open Dialog action of the Input configuration of the buttons. Some dialogs are openend using the FbOpenDialogExtended FB of the Visu Utils library and the FbOpenDialogExtended FB is called in the Execute ST-Code action. I am also using the FileOpenSave dialog from Visu Dialogs which requires an OnDialogClosed action to read out. I realized that the OnDialogClosed action which is meant for the FileOpenSave dialog also triggers if a dialog is closed, which was previously openend using the FbOpenDialogExtended FB. Is there a way to detect which dialog was closed last and specify to which dialogs the OnDialogClosed action reacts?
Last updated: 2023-09-20
Post by installwhat on IDialogOpenedListener
CODESYS Forge
talk
(Post)
Why do you develop things like this? The workflow should be highly dependent on autocomplete, then if that's not super obvious browse to definition and everything is made clear possibly with the checking of a few types. The nature of how things are done makes me think these libraries aren't developed for general use and are actually internal or for partners. The example projects include objects that don't appear in autocomplete and then lead nowhere obvious when browsing. Do you consider developer workflow when creating these libraries? Are some libraries really for public use such as Visu Utils and others not? If so which? It's really hard to tell.
Last updated: 2024-08-06
Post by shawn-plc on Return value from a tag given a string literal
CODESYS Forge
talk
(Post)
Good afternoon everyone, I am looking for a way to return a value given a string tag path. I put together a pseudo-example to illustrate my use-case and was wondering if anyone in this forum can help. The function fnValueFromTagPath is the function I am looking to either create or use from existing library. I would greatly appreciate it. Please see the attachment for additional detail. -Shawn
Last updated: 2024-08-13
Post by andrebrandt on FB string and naming
CODESYS Forge
talk
(Post)
Hi all. I have a FB written in ST. FUNCTION_BLOCK NTC10k VAR_INPUT Syst:STRING; In:REAL; END_VAR VAR_OUTPUT Out:REAL; OTag:STRING; Out_St:Struct_NTC10K; END_VAR VAR Tag:STRING; InstanceName: STRING; Structure:Struct_NTC10K; END_VAR What i'm trying to do, is to pass data to structure. In structure i want to add a tag with systemnumber and sensorname. '320.001-RT401' In pou i use this RT401: NTC10k;, and tried this RT401: NTC10k(Tag:='RT401'); Anyone done this?
Last updated: 2024-09-26
Post by vstrom on Recipe definition, how to have the Name string in current language?
CODESYS Forge
talk
(Post)
I'd like to know if it is possible to have the "Name" field, in the recipe definition, language dependent. Something like to have the possibility to put there a string ID that will be add to the GlobalTextList. In this way it can be translated and when showed in a Visualization screen its value depend on the current language. Thanks.
Last updated: 2024-10-04
Post by sedoerr on Check For Open Dialogs On Client
CODESYS Forge
talk
(Post)
FUNCTION CheckDialogOpen : BOOL VAR_INPUT sDialogName : STRING; END_VAR VAR pstClientData : POINTER TO VisuElems.VisuStructClientData; itfDialogManager : VisuElems.IDialogManager; itfMyDialog : VisuElems.IVisualisationDialog; END_VAR VisuElems.g_ClientManager.BeginIteration(); WHILE (pstClientData := VisuElems.VisuElemBase.g_ClientManager.GetNextClient()) <> 0 DO itfDialogManager := VisuElems.g_VisuManager.GetDialogManager(); itfMyDialog := itfDialogManager.GetDialog(sDialogName); CheckDialogOpen := VisuDialogs.VisuDlgUtil_IsDialogOpen(itfMyDialog,pstClientData,itfDialogManager); IF CheckDialogOpen THEN EXIT; END_IF END_WHILE
Last updated: 2023-09-26
Post by captaincookie on increase default string length in queue
CODESYS Forge
talk
(Post)
I solved it by creating a new element of IElement according to the ElementExample (MyElement) in the ElementCollectionsExamples project. The variables in this element can then be defined in any properties as needed.
Last updated: 2023-10-11
Post by paro on OPCUA array max length?
CODESYS Forge
talk
(Post)
I think the amount of data is already relatively high and maybe it has something to do with that? Maybe also the CPU load of your device? an array with string(5000)? and have you tested with how many array elements it still works?
Last updated: 2024-02-17
Post by dhumphries on Not able to see input data coming from eip adapter on codesys
CODESYS Forge
talk
(Post)
The green icon with an ! next to the device is concerning. Is the data type correct for the input, you are using a byte input but the description says string. Is there anything useful in the status tab?
Last updated: 2024-03-06
Post by dkugler on I want to convert a WORD to a hex string like 15.432 to '3C48'
CODESYS Forge
talk
(Post)
you try to convert a WORD with BYTE_TO_HEX directly? Using https://de.helpme-codesys.com/ lead to the SM3_shared lib. There is a function: https://content.helpme-codesys.com/en/libs/SM3_Shared/Current/SM3_Shared/StringFormat/Word_To_HexString.html
Last updated: 2024-04-19
Post by damian177 on Raspbery Pi and Calendar
CODESYS Forge
talk
(Post)
Hi, In my visualisation I have a "Calendar" control. I would like save day and month which will be clicket by operator on this control . forexample save in string array. How do this ?
Last updated: 2024-04-23
Post by damian177 on Visualization - table element
CODESYS Forge
talk
(Post)
Hi, In my application I use table elemnt with filled by STRING ARRAY. I would like to implement the following functionality : When I click on second row, that this row will be cleared. Anyone can help me?
Last updated: 2024-04-25
Post by installwhat on How to access to variable value through symbolic string name
CODESYS Forge
talk
(Post)
Maybe your question makes sense but I don't see it. Maybe you should rephrase and add a lot of detail
Last updated: 2024-06-13
Post by andreag0 on How to access to variable value through symbolic string name
CODESYS Forge
talk
(Post)
Good to know. I am looking for some soluction to avoid PLC Handler and OPC-UA. Thank you.
Last updated: 2024-06-14
Post by timvh on Help with DynamicTextGetTextW
CODESYS Forge
talk
(Post)
First of all you need to enable "Use unicodestrings" in the Visualization Manager. This function returns a pointer to a WSTRING (not STRING). To get this wstring value, do something like this: VAR myWstringVariable : WSTRING(255); END_VAR myWstringVariable := myResult^; // this is dereferencing the pointer to the WSTRING.
Last updated: 2024-09-03
Post by opineiro on How to manage variable types larger than 64 bits - Ethernet/IP
CODESYS Forge
talk
(Post)
Thanks, that's what I thought initially. The point is that I can't select a String type variable. See the attached image
Last updated: 2024-09-23
Post by rmaas on CSV file and string manipulation.
CODESYS Forge
talk
(Post)
the $N stands for newline and $R stands for line break. maybe these combinations are considered as 1 character/position? Not sure, just a thought... see also: https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_operands_constant_string.html#:~:text=A%20string%20constant%20is%20a,belong%20to%20this%20character%20set.
Last updated: 2024-09-27
Post by nano on FB string and naming
CODESYS Forge
talk
(Post)
inside the fb, use the reflection-attribute and get the instancename includibg whole path.when im right, the applicationname will also reflected, if yes. you have to trim it. https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_pragma_attribute_instance_path.html
Last updated: 2024-10-02
To search for an exact phrase, put it in quotes. Example: "getting started docs"
To exclude a word or phrase, put a dash in front of it. Example: docs -help
To search on specific fields, use these field names instead of a general text search. You can group with AND
or OR
.