HEX2 statement result to variable?


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2013
    Posts
    1,123

    Default HEX2 statement result to variable?

    Hello.

    I have the code:

    Code:
    lcdout $FE,$C0,"Hr:",HEX2 hh,":",HEX2 mm
    which works ok

    but when I want to use

    Code:
    A=HEX2 hh
    it does not works.

    How should I ?

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,605


    Did you find this post helpful? Yes | No

    Default Re: HEX2 statement result to variable?

    Hi,
    How should you what?
    The HEX, DEC, BIN modifiers are used to present the same number in different ways - but it's still the same number. A value of 10 is always 10 but depending on the modifer used it can be displayed as DECimal (10) HEXadecimal (A) or BINary (00001010) but again it's still the same value.

    Lets say hh has the value of 123, what do you expect A to be?

    /Henrik.

  3. #3
    Join Date
    Feb 2013
    Posts
    1,123


    Did you find this post helpful? Yes | No

    Default Re: HEX2 statement result to variable?

    Yes, so I want to convert a number from BCD to DEC.

    I've already found a solution:

    hh =( hh >> 4 * 10 ) + ( hh // 16 )

    But I thought there should be some statement?

Similar Threads

  1. RCTIME not getting a result
    By tasmod in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th January 2012, 14:28
  2. XOR result different with PC application
    By Pic2008 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 26th January 2009, 04:56
  3. Strange LED Result!!
    By BobP in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th April 2007, 15:59
  4. RANDOM - always the same result
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 18th March 2007, 12:58
  5. A/D display result on LCD
    By winsthon in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 10th January 2004, 10:09

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