SWRITE : format to convert INT to bit string 'Bbbbb' ?

  • Hello,


    I would like to convert an INT to its BIT string representation (like for STATUS and TURN) to display it on the KCP in a message.
    Is there a built-in format or function to do that in KRL or should I do that by hand with bitwise operations ?


    For instance : 10 > 'B1010'


    Thanks,

  • Place your Ad here!
  • Well, I did check this manual several times but could not sort this out myself.
    I've tested several format options but could not display a KRL message translating 10 to `B1010` for instance.


    So I ended up with a custom function with bit per bit testing :



    I would still be interested by a solution with SWRITE and %r format if someone is able to manage this !

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now

Advertising from our partners