Byte to Hex


Closed Thread
Results 1 to 8 of 8

Thread: Byte to Hex

Hybrid View

  1. #1
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Byte to Hex

    If that were to be output as a pair of ASCII bytes, I might go (after the above code)..
    Code:
    IF bytea > 9 THEN
    bytea = bytea + $07
    ENDIF
    bytea = bytea + $30
    
    IF byteb > 9 THEN
    byteb = byteb + $07
    ENDIF
    byteb = byteb + $30

  2. #2
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Byte to Hex

    Or simple use arraywrite:
    OutputArray VAR BYTE[6]
    ARRAYWRITE OutputArray,[HEX2 byte1, HEX2 byte2,..., HEX2 byte6]

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,680


    Did you find this post helpful? Yes | No

    Default Re: Byte to Hex

    Or simple use arraywrite:
    OutputArray VAR BYTE[6] ???
    ARRAYWRITE OutputArray,[HEX2 byte1, HEX2 byte2,..., HEX2 byte6]
    OutputArray VAR BYTE[12]
    Warning I'm not a teacher

  4. #4
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: Byte to Hex

    You might try using:

    HEX1 VAR WORD
    HEX2 VAR WORD

    BYTE1 VAR BYTE (etc)

    BYTE1 = HEX1.HIGHBYTE
    BYTE2 = HEX1.LOWBYTE

Similar Threads

  1. HEX byte to ASCII output...
    By johnmaetta in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 13th August 2011, 00:31
  2. Increment a Byte
    By savnik in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 21st November 2009, 11:09
  3. byte compression
    By Norbert in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 16th June 2007, 18:04
  4. Convert 3-byte hex to dec to display on LCD
    By lab310 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 10th June 2005, 19:20
  5. Splitting a byte?
    By Deadeye in forum General
    Replies: 3
    Last Post: - 29th May 2005, 21:58

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts