.CONVERT NUM TO HEX PR

This subroutine converts a decimal number to a hex pair of alpha characters.


Usage:

    PASS        <hex pair>                FIELD           SHARE? Y
    PASS        <decimal_number>          FIELD           SHARE? N
    GOSUB   --- .CONVERT NUM TO HEX PR
     *       Check for errors
    IF      --- .CONVERT NUM TO HEX PR    NE

Description:

This subroutine converts a number to a hex pair of alpha characters. Both parameters are required, the subroutine will CANCEL if they are not PASSed.

<hex_pair> will contain the hexidecimal equivalent of <decimal_number> (Required). This must be PASSed with Share "Y" to return the result.

<decimal_number> is the value you want converted (Required). This be an integer in the range 0-255.

If you want to convert a string of characters to hexidecimal, see .CONVERT BYTES TO HEX. To convert a hexidecimal number to decimal, see .CONVERT HEX PR TO NUM.

Comments:

Read what other users have said about this page or add your own comments.


-- PeteBrower - 2011-08-12

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r2 - 2012-02-03 - JeanNeron
 
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback