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 Tue Feb 18, 2020 8:35 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Mon Jan 13, 2020 11:33 pm 
Offline

Joined: Thu Apr 11, 2019 2:33 pm
Posts: 10
Is it possible to modify a entries in a textlist while an application is running? For example, I would like to be able to open an on-screen keyboard and have the user be able to type in string and overwrite a textlist entry with that new string. Then, I'd like that new string to show up in dropdown lists.

Thanks.


Top
   
PostPosted: Tue Jan 14, 2020 4:57 am 
Offline
Frequent User
Frequent User

Joined: Thu Mar 17, 2016 1:24 pm
Posts: 209
It's possible. Textlists are downloaded to plc as common .txt files (in /PlcLogic/Visu folder).

You can edit it in your program (with libs SysFile, CAA File, etc.) and you should use function DynamicTextReloadTexts from СmpDynamicText library to "refresh" texts in application.

Attachment:
14-01-2020 6-53-39.png


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

_________________
Make CODESYS great again


Top
   
PostPosted: Tue Jan 14, 2020 7:45 pm 
Offline

Joined: Thu Apr 11, 2019 2:33 pm
Posts: 10
Thank you! Modifying the text list works!

However, I am having another issue. When I try to use SysFile functions (currently SysFileRead) to read a .txt file generated from a text list, the string that I get back doesn't seem to be standard letters. Is the format of the .txt file "normal"?

I attached a screenshot as well.


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


Top
   
PostPosted: Tue Jan 14, 2020 9:07 pm 
Offline

Joined: Thu Apr 11, 2019 2:33 pm
Posts: 10
Also, when I use the "nano" command to read the txt file, I get "^@" in between every letter, and an ^M^@ at the end of every line. Attached is a screenshot. Is there something odd about the .txt file that is generated by Codesys?


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


Top
   
PostPosted: Tue Jan 14, 2020 11:13 pm 
Offline

Joined: Tue Mar 26, 2019 4:28 pm
Posts: 91
Interesting. When the first two characters of a text file are ÿþ, that is a notice to the text editor that it is a UTF-16 LE encoded file (is unicode). More details on Wikipedia.

https://en.m.wikipedia.org/wiki/Byte_order_mark

The ^@ character represents the byte 00 or null. This is to be expected, as a unicode UTF-16 LE uppercase letter 'I' is '49 00' in hex.

nano is a simple text editor, hence its name. It cannot handle BOM nor UTF-16. Maybe use a different text editor like vim (I am no

What is also interesting, is that your sysfileread is giving you only the first three bytes in your string. If you know a bit about the storage format of CODESYS Strings, you will know that the first byte of the memory location is the first character. The end of the string is either the whole string size, or the first NULL character (hex 00). So of course the letter I (49 00) contains a NULL, and so locates the end of your string.

Try with a WSTRING, which is UTF-16 already. (not sure LE or BE, or worse if it is processor dependant) (you might have to write code to delete the BOM character, if present)


Top
   
PostPosted: Sun Jan 19, 2020 5:27 am 
Offline

Joined: Thu Apr 11, 2019 2:33 pm
Posts: 10
I figured it out! I had "use unicode settings" checked in the visualization manager, so codesys was writing all of the textlist .txt files in unicode format, which would have be useful if I had different languages. I unchecked the unicode settings box and the txt file was fine.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 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