Search talk: extract string

 
<< < 1 .. 8 9 10 11 12 > >> (Page 10 of 12)

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

Post by ph0010421 on Converting each character to a string into ASCII CODESYS Forge talk (Post)
So the printer wants an ASCII conversion of the hex equivalent of ASCII characters?? They don't make it easy for us
Last updated: 3 days ago

Post by jari-koivuluoma on Problem trying Net Base Services 3.5.15.0 TCP connection CODESYS Forge talk (Post)
I have a need to send messages between 2 PLCs and I cant use network variables (because of size limit) so I tried writing this simple test program. This seems to work fine. I can send messages back and forth when a first "Start server" and then "Connect client". See the attached image. However, if I disconnect the client by setting ClientConnect to false and try to re-connect then the TCP_Client just gives me TIMEOUT error. When I stop and start the server again, then Im able to reconnect. How is this supposed to work? Why reconnecting wont work. There is not other way of disconnecting the client than setting xEnable of the TCP_Client to false. This is just a testing program and I will try it on 2 seperate devices once this works. PROGRAM PLC_PRG VAR CONSTANT mySize : UDINT := 255; END_VAR VAR Server: NBS.TCP_Server; ServerIpStr: STRING := '127.0.0.1'; ServerIP: NBS.IP_ADDR; ServerPort: UINT := 50000; ServerConnection: NBS.TCP_Connection; Client: NBS.TCP_Client; ServerRead: NBS.TCP_Read; ServerWrite: NBS.TCP_Write; ServerSend: STRING(mySize); ServerReceive: STRING(mySize); ServerConnect: BOOL; bServerSend: BOOL; IP: NBS.INADDR; ConnectedClientIP: STRING; ClientPort: UINT := 50000; ClientIpStr: STRING := '192.168.1.49'; ClientIP: NBS.IP_ADDR; ClientRead: NBS.TCP_Read; ClientWrite: NBS.TCP_Write; ClientSend: STRING(mySize); ClientReceive: STRING(mySize); ClientConnect: BOOL; bClientSend: BOOL; Error: BOOL; Message: BOOL; END_VAR // Server ServerIP.sAddr := ServerIpStr; Server( ipAddr := ServerIP, uiPort := ServerPort ); ServerConnection( xEnable := Server.xEnable, hServer := Server.hServer, ); IP := ServerConnection.IPAddress; ConnectedClientIP := F_Concat7( BYTE_TO_STRING(IP.S_un_b.s_b1),'.', BYTE_TO_STRING(IP.S_un_b.s_b2),'.', BYTE_TO_STRING(IP.S_un_b.s_b3),'.', BYTE_TO_STRING(IP.S_un_b.s_b4)); ServerRead( xEnable := ServerConnection.xActive, hConnection := ServerConnection.hConnection, szSize := SIZEOF(ServerReceive), pData := ADR(ServerReceive) ); IF ServerRead.xReady AND ServerRead.szCount > 0 THEN Message := TRUE; END_IF IF ServerRead.eError > 0 THEN Error := TRUE; END_IF ServerWrite( xExecute := ServerConnection.xActive AND bServerSend, hConnection := ServerConnection.hConnection, szSize := LEN(ServerSend)+1, pData := ADR(ServerSend) ); IF ServerWrite.xDone THEN bServerSend := FALSE; END_IF IF ServerWrite.eError > 0 THEN Error := TRUE; END_IF // Client ClientIP.sAddr := ClientIpStr; Client( xEnable := ClientConnect, ipAddr := ClientIP, uiPort := ServerPort, udiTimeOut := 10000000 ); ClientRead( xEnable := Client.xActive, hConnection := Client.hConnection, szSize := SIZEOF(ClientReceive), pData := ADR(ClientReceive) ); IF ClientRead.xReady AND ClientRead.szCount > 0 THEN Message := TRUE; END_IF IF ClientRead.eError > 0 THEN Error := TRUE; END_IF ClientWrite( xExecute := Client.xActive AND bClientSend, hConnection := Client.hConnection, szSize := LEN(ClientSend)+1, pData := ADR(ClientSend) ); IF ClientWrite.xDone THEN bClientSend := FALSE; END_IF IF ClientWrite.eError > 0 THEN Error := TRUE; END_IF
Last updated: 2024-10-03

Post by albzen on EtherCat Slaves diagnosis CODESYS Forge talk (Post)
Hello everybody, I'm working on a RunTime Plc (Codesys 3.5.16/18.20) connected to an EtherCat bus with many devices. The bus has some communication fault but I don't know how understand which is the device or the cable that has the trouble. To understand the cause of the problem I would like to read the WKC (Working counter) of the devices (0x0300...0x030C), how is explained in EtherCat documents, but it seems that the read of the counter is disabled. Attached there is an extract of the Ethercat document. Can anyone give me some advice about how and with function can I read it. Thank you in advance!
Last updated: 2024-03-29

Post by albzen on EtherCat Slaves diagnosis CODESYS Forge talk (Post)
Hello everybody, I'm working on a RunTime Plc (Codesys 3.5.16/18.20) connected to an EtherCat bus with many devices. The bus has some communication fault but I don't know how understand which is the device or the cable that has the trouble. To understand the cause of the problem I would like to read the WKC (Working counter) of the devices (0x0300...0x030C), how is explained in EtherCat documents, but it seems that the read of the counter is disabled. Attached there is an extract of the Ethercat document. Can anyone give me some advice about how and with function can I read it. Thank you in advance!
Last updated: 2024-03-29

Post by amy123 on Alarm Manager Example Alarm Client doesn't Populate CODESYS Forge talk (Post)
Hello, I tried to run the example project from https://forge.codesys.com/prj/codesys-example/alarm-manager/home/Home/ However, I can not get the interface for Alarm History 12 Alarm Manager client to populate with any alarms. 'udiResult := AlarmManager.g_AlarmHandler.RegisterClient(itfAlarmManagerClient12, ADR(arritfAlarmsFromHistory12), iMaxCountAlarmsFromHistory12);' when I look at itfAlarmManagerClient12 its always empty. What is confusing is that when I simulate 2 alarms, iCountActiveAlarms 12 has a vlaue of 2, associated with itfAlarmManagerClient12 - so that appears to work. And yet, its useless as the ProcessAlarms Function can't extract anything from the empty array. I dont understand how these arrays are supposed to be populated and why its not working. Any help would be greatly appreciated!
Last updated: 2024-07-15

Post by gustavocsw on MQTT memory leak problem CODESYS Forge talk (Post)
Hello everyone, I'm using the IoT Library to implement the MQTT communication with my local broker server in order to publish and subscribe at specifics topics to share and consume information about my application. But, it seems that are occurring some memory leak problem in a "high" frequency (more than 10 Hz) subscribe process. I follow the same method as in IoT Lib exemples, and at first looks perfect but my PLC was rebooting frequently and when I check its memory usage that was increasing as fast as the subscribe massage was sent. I'm using a WEG PLC410 and a WEG PLC500, and this error occurred in both of them (including in CODESYS Control Win x64). The application sends to the system a message JSON with the float payload Ex. {"data" : 0.8500}, but this happens with a INT, or BOL as well. I use the follow code in my application to find the value: //FindFirstValueByKey VARs PROGRAM JSON_VELO VAR //------Setting the JSON Subscriber to Set the Relay Value jsonDataVelo : JSON.JSONData; jsonByteArrayReaderVelo : JSON.JSONByteArrayReader; xST1okVelo : BOOL; FindFirstValueByKeyVelo : JSON.FindFirstValueByKey; jsonElementVelo : JSON.JSONElement; xDoneReaderVelo : BOOL; xDoneFindVelo : BOOL; //STRING and WSTRING for Subscribe the massage sPayloadJsonVelo : STRING := 'opa'; psPayloadJsonVelo : POINTER TO BYTE := ADR(sPayloadJsonVelo); //wsPayloadJsonRelaySet : WSTRING := "opa"; wsPayloadJsonVelo : WSTRING := STRING_TO_WSTRING('opa'); pwsPayloadJsonVelo : POINTER TO WORD := ADR(wsPayloadJsonVelo); lrVelo : LREAL; xKeepAliveVelo : BOOL; xSetVelo : BOOL; RSSet : RS; LIMPAR : STRING; //Find the msg end sFindVelo : STRING := '}'; psFindVelo : POINTER TO STRING := ADR(sFindVelo); iLenVelo : INT; iSizeVelo : INT := 12; udiContMsg : UDINT; END_VAR // FindFirstValueByKey CODE // Relay Set configuration xSetVelo := MQTT_SUBSCRIBER.RSVelo.Q1; IF xSetVelo THEN xKeepAliveVelo := TRUE; END_IF IF xKeepAliveVelo THEN udiContMsg := udiContMsg + 1; iLenVelo := TO_INT(StrLenA(psPayloadJsonVelo)); iSizeVelo := iLenVelo - TO_INT(MQTT_SUBSCRIBER.udiPayloadSizeVelo); StrDeleteA(psPayloadJsonVelo,iSizeVelo,iLenVelo); wsPayloadJsonVelo := STRING_TO_WSTRING(sPayloadJsonVelo); pwsPayloadJsonVelo := ADR(wsPayloadJsonVelo); //MQTT.ConvertUTF8toUTF16(sourceStart:= ADR(sPayloadJsonVelo), targetStart:= ADR(wsPayloadJsonVelo), dwTargetBufferSize:= TAM, bStrictConversion:= 1); //Reset jsonByteArrayReader jsonByteArrayReaderVelo ( xExecute := TRUE, pwData := pwsPayloadJsonVelo, jsonData := jsonDataVelo, xDone => xDoneReaderVelo ); FindFirstValueByKeyVelo( xExecute := xDoneReaderVelo, wsKey := "data", diStartIndex:= 0, jsonData := jsonDataVelo, jsonElement => jsonElementVelo, xDone => xDoneFindVelo ); IF xDoneFindVelo THEN lrVelo := jsonElementVelo.value.lrValue; //Reset jsonByteArrayReader jsonByteArrayReaderVelo ( xExecute := FALSE, pwData := pwsPayloadJsonVelo, jsonData := jsonDataVelo, xDone => xDoneReaderVelo ); FindFirstValueByKeyVelo( xExecute := FALSE, wsKey := "data", diStartIndex:= 1, jsonData := jsonDataVelo, jsonElement => jsonElementVelo, xDone => xDoneFindVelo ); xKeepAliveVelo := FALSE; GVL.xSetVeloRead := TRUE; END_IF END_IF And this to subscribe at the topic: //SUBSCRIBE VAR: //----------------- Subscribe Velocity ----------------------- MQTTSubscribeVelo : MQTT.MQTTSubscribe;//Variable MQTTSubscriber block -X - function-X wsTopicSubscribeVelo : WSTRING(1024) := "CORE/odometry/GET/data/simp"; // Topic to publish a message sSubscribeMassageVelo : STRING; udiPayloadSizeVelo : UDINT; xSDoneVelo : BOOL; xSErrorVelo : BOOL; xReceiveVelo : BOOL; eSTypeVelo : MQTT.MQTT_ERROR; eSMQTTErrorVelo : MQTT.MQTT_ERROR; RSVelo : RS; udiCont : UDINT; //SUBSCRIBE CODE: MQTTSubscribeVelo( xEnable:= MQTT_CLIENT.xConnection_Broker AND NOT xSErrorVelo AND NOT JSON_VELO.xKeepAliveVelo, pbPayload:= JSON_VELO.psPayloadJsonVelo, udiMaxPayloadSize:= SIZEOF(JSON_VELO.sPayloadJsonVelo), udiPayloadSize => udiPayloadSizeVelo, mqttClient:= MQTT_CLIENT.ClientMQTT, wsTopicFilter:=wsTopicSubscribeVelo, xDone => xSDoneVelo, xError=> xSErrorVelo, xReceived => xReceiveVelo, eMQTTError=> eSMQTTErrorVelo ); RSVelo(SET := xReceiveVelo, RESET1 := JSON_VELO.xKeepAliveVelo);
Last updated: 2024-09-09

Post by george32 on CSV file and string manipulation. CODESYS Forge talk (Post)
Dear folks, I think I have a rather simple question but I could not find the right answer to my question: I have made with Excel a CSV file where I would like to have some general data regarding my program variables. I have made an program what let me read the file. The string I am currently get is at follows: 'IP_Adres;192.168.45.12$R$NPort_number;2000$R$NCycle_time;43$R$NStart_Standard_IO;20$R$N' Now I want to split the string in multiple part, which I later would connect to the right variable. By Google and experimenting I have reached to the following code for the first part of the splitting proces: // Splitting the BOM of the string: Received_string := FileReadString; IF LEFT(STR:=New_string,3)= '' THEN Received_string_without_BOM :=RIGHT(STR:= Received_string,SIZE:= (LEN(STR:= Received_string))-3); END_IF //Splitting the remaining string in part for later declaration. WHILE index = 0 DO index_split_part := FIND(STR1:= Received_string_without_BOM,STR2:= '$R$N'); Part_of_String[index]:=LEFT(STR:=Received_string_without_BOM, SIZE:= index_split_part); index := index + 1; END_WHILE However in the splitting proces I could not understand what is really happening. I understand that the Find() function returns the first value the $R$N in the Received_string_without_BOM. This would mean that the index_split_part := 23 I|P| _ |A |d|r|e|s|;|1_|9 |2 |. |1 |6 |8 |. |4 |5 |. |1 |2 |$ |R |$ |N |P | 1|2| 3 |4 |5|6|7|0|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27| So the next part is to read the first 23 characters of the Received_string_without_BOM with the LEFT() function. I expected that the outcome the following was: 'IP_Adres;192.168.45.12$'. However the outcome is: 'IP_Adres;192.168.45.12$R'. I do not understand where the R after the $ sign comes from, because its place is 24 so it would not be added to the part_of the_string[index]. If I hard coded value 24 for the size it gives me the following return: 'IP_Adres;192.168.45.12$R$N'. I would expect everything till the R but the code adds the $N also to the string. I hope someone could explain to my what I am seeing wrong in my point of view? With kind regards, George
Last updated: 2024-09-27

Post by kevinl on RevPi Connect RS485 CODESYS Forge talk (Post)
I figured this out on my own with this logic: usually the Serial port on a Raspberry pi is on /dev/ttyUSB0 then you need to set linux.DeviceFile=/dev/ttyUSB in codesys you then must set com port to 1 so i assumed codesys subtracts 1 from the number and adds this to the filename... (in code it would look like this: var comPort : byte := '1'; linuxDevice : string := '/dev/ttyUSB'; filename : string; end_var filename := concat(linuxDevice, (to_string(comPort-1)); filaname then is /dev/ttyUSB0 RevPi uses ttyRS485 as Serial port so you must remove the last number from the name and set the com port to this number +1 i hope this is understandable ;-)
Last updated: 2023-12-11

Post by dkugler on Toggling Visualizations using HMI Physical Buttons CODESYS Forge talk (Post)
the magic option is named "Use CurrentVisu variable" activate this option in the Visualization Manager an have a look: https://help.codesys.com/webapp/_visu_obj_manager;product=core_visualization;version=3.5.14.0 if your button is pressed, "feed" the string varable VisuElems.CurrentVisu := 'visu1'; with the correct name of the depending visu. alternative: place a frame element at a empty main visu, konfigure all visus to be shown by this frame. With setting the switching variable of the frame to the index value of the depending visu, it will switch to it. Advantage: the visu names are not hardcoded as string in the ladder lodgic. Good luck! Hint: If you have multiple VisuClients(Target, WebVisu,...) all will show the same visu. Independent switching is much more difficult, but there is a example from codesys.
Last updated: 2024-02-13

Post by amy123 on codesys mqtt publish serialization CODESYS Forge talk (Post)
Hello, I am using the CODESYS IIoT Libraries SL MQTT Publish. Does this publish block only support publishing STRINGS as a readable format? I can publish ENUM, STRUCT, BOOL; however, MQTT Explorer will only display strings. When I use Wireshark, I can see that it is publishing something, but it looks to be publishing a serialized version which is a bunch of 0s or random text. If so, is there any way to deserialize this information back into a readable format? See pictures, where I have a BOOL TRUE that gets published as 001. Then see where I publish a STRUCT and it's an incomprehensible combination of 0s - only the string variable is displayed. Or, is it expected that you convert everything to a string before publishing? Any help is greatly appreciated! :)
Last updated: 2024-02-16

Post by thn-power on How to change OPC NodeId IdentifierType CODESYS Forge talk (Post)
Hi Yet another OPC UA question. When setting up a OPC server using "Communcation manager" (Symbol set and information model) in Codesys the NodeId is always given as "opaque" type. At least when browsing using UAExpert. Other standard OPC objects use numeric (or string) identifier, but for some reason my variables seems to get opaque/binary type. See attached photo. How can I change this? I can't see that this is a parameter in the CodesysControl.cfg. Can this be specified in the information model nodeset? And is it possible to specify the exact numeric or string NodeId for each instance? And on a related topic, is there a way to export the OPC server nodeId's with variable name so that it can be imported in a OPC Client? The .xml files in the project folder does not seem to contain the NodeId.
Last updated: 2024-09-20

Post by timvh on FB string and naming CODESYS Forge talk (Post)
I see, you want to initialize the FB. To be able to initialise it like you described, you need to add the FB_Init method to your FB. (right click on the FB, select add object --> method). Then press the arrow down, to select the FB_Init (overwrite default implementation). In the VAR_INPUT section of this method, add the variable --> Tag : STRING; Then in the code section of this method add: THIS^.Tag := Tag; // copy initial value to local variable in FB Search Google if you want to know more about FB_Init. PS, reflection + instance path, is also an option if you want to get the full name of the instance (path) of the Function Block. See: https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_pragma_attribute_instance_path.html
Last updated: 2024-09-30

Post by talhaali on Adding a variable from text list into ST code CODESYS Forge talk (Post)
Hi, can I use a entry of a text list as variable in structured text? for example in attach picture, if i use want to use data of first row. I am trying to write: A : STRING := TextList.Default.0; but it is not workings
Last updated: 2023-12-07

Post by talhaali on Adding a variable from text list into ST code CODESYS Forge talk (Post)
Hi, can I use a entry of a text list as variable in structured text? for example in attach picture, if i want to use data of first row. I am trying to write: A : STRING := TextList.Default.0; but it is not workings
Last updated: 2023-12-07

Post by evanclegg on Digital Clock CODESYS Forge talk (Post)
To display the current time, you’ll need to retrieve it from the system clock. In CODESYS, you can use the built-in function SysTime to get the current system time. Here’s an example of how you can use it: VAR dtCurrentTime: DATE_AND_TIME; sTime: STRING(8); END_VAR dtCurrentTime := SysTime(); sTime := TIME_TO_STRING(dtCurrentTime.t); The sTime variable now contains the current time in the format “HH:MM:SSuno online".
Last updated: 2024-02-28

Post by nano on How to access to variable value through symbolic string name CODESYS Forge talk (Post)
this is not easily. From Point of SL-Licenses Codesys didnt provide the informations how to do. We created an own CDS-Component for that Behaviour. This Informations are available for OEM, if you are an OEM you can find the Informations in the RTS-Documentation.
Last updated: 2024-06-14

<< < 1 .. 8 9 10 11 12 > >> (Page 10 of 12)

Showing results of 292

Sort by relevance or date