Hi Guys,
New here and a little quick question.
Is there a FB that will convert a letter, say "A" to number so it can be sent via BYTE then changed from BYTE back to the letter?
Cheers,
Hi, you can use STRING_TO_BYTE() and BYTE_TO_STRING().
...or any other STRING_TO_.... Function.
you can even send the string as it will be in ascii bytes.
Another easy method,
Just map a memory address to var string and read the same memory address in var byte you will get the ASCII value for the string
for example
Var1 At %MB100 : String; Var2 At %MB100 : Byte;
what ever the character in var1 the corresponding ASCII value will be displayed in Var2
Regards Balaji
yes balaji it works in codesys, however this is not standard 61131-3 so i am reluctant to use it.
Log in to post a comment.
Hi Guys,
New here and a little quick question.
Is there a FB that will convert a letter, say "A" to number so it can be sent via BYTE then changed from BYTE back to the letter?
Cheers,
Hi,
you can use STRING_TO_BYTE() and BYTE_TO_STRING().
...or any other STRING_TO_.... Function.
you can even send the string as it will be in ascii bytes.
Another easy method,
Just map a memory address to var string and read the same memory address in var byte you will get the ASCII value for the string
for example
Var1 At %MB100 : String;
Var2 At %MB100 : Byte;
what ever the character in var1 the corresponding ASCII value will be displayed in Var2
Regards
Balaji
yes balaji it works in codesys, however this is not standard 61131-3 so i am reluctant to use it.