I have an application that needs to support multiple languages therefor I need to be able to display special letters.
I will receive each letter as an utf-16 as 2 bytes via CAN messages.
If I do this:
WStr:="$0400" I get the visualization Π Which is correct.
My challenge here is that the data I receive via CAN will only be 04 00.
I can simply not get the application to show the result I need.
Can anyone help on a good solution or just a solution.
I am running Codesys 3.5 and the application is running on an IFM terminal.
I would also like to be able to do this in Codesys 2.3
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Maybe you need to try byteswapping.
MemUtils.MemCpy() can copy the bytes from where they are to your WSTRING
You then need to find a byteswap function somewhere if required. Maybe MemUtils.Swap or MemForceSwap
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
$ is just an escape character. "$0400" means 'a two byte character, lowbyte is 00, high byte is 04'
Might be easier to do:
Wstr[0] := %IW0;
Wstr[1] := %IW1;
etc.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have an application that needs to support multiple languages therefor I need to be able to display special letters.
I will receive each letter as an utf-16 as 2 bytes via CAN messages.
If I do this:
WStr:="$0400" I get the visualization Π Which is correct.
My challenge here is that the data I receive via CAN will only be 04 00.
I can simply not get the application to show the result I need.
Can anyone help on a good solution or just a solution.
I am running Codesys 3.5 and the application is running on an IFM terminal.
I would also like to be able to do this in Codesys 2.3
Maybe you need to try byteswapping.
MemUtils.MemCpy() can copy the bytes from where they are to your WSTRING
You then need to find a byteswap function somewhere if required. Maybe MemUtils.Swap or MemForceSwap
It is more a question about getting the $ into my Wstring so it can be seen as a Unicode.
$ is just an escape character. "$0400" means 'a two byte character, lowbyte is 00, high byte is 04'
Might be easier to do:
Wstr[0] := %IW0;
Wstr[1] := %IW1;
etc.
@i-campbell
Thanks but my Russian is not my strong side :-)
But I think I need to clarify my problem a bit better.
A simple example
I will receive 2 CAN frames with each 2 databytes.
Can message 1 databyte = 00 48 (H)
Can message 2 ddatayte = 00 49 (I)
I will need these two can messages to become the word "Hi" in a wstring.
Can you access these (00 48 00 49) as a byte array or word array already?
They will be in a USINT Array
Since this is the datatype for the CAN messages used by IFM
Last edit: rasmus-houtved 2020-06-30
Add the CAA Memory library.
Related
Talk.ru: 1
Talk.ru: 2
Talk.ru: 3
Thanks
It works as I would like it to work.