Letter to ASCII

thebig1
2012-06-27
2012-07-13
  • thebig1 - 2012-06-27

    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,

     
  • singleton - 2012-06-27

    Hi,
    you can use STRING_TO_BYTE() and BYTE_TO_STRING().

    ...or any other STRING_TO_.... Function.

     
  • shooter - 2012-06-27

    you can even send the string as it will be in ascii bytes.

     
  • balajimct - 2012-07-06

    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

     
  • shooter - 2012-07-13

    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.