hexadecimal


Closed Thread
Results 1 to 11 of 11

Thread: hexadecimal

Hybrid View

  1. #1
    thibaud's Avatar
    thibaud Guest

    Talking hexadecimal

    Maybe a suppied question

    I want to connect a zigbee via serial interface to a PIC 18F877.

    want is the command to present something in HEX!!

    I always have to work with binairy to make it workable:

    a = %10101000 what is the hex command


    thanks

  2. #2
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    4.8. Numeric Constants (rtfm)

    PBP allows numeric constants to be defined in the three bases: decimal, binary and hexadecimal. Binary values are defined using the prefix '%' and hexadecimal values using the prefix '$'. Decimal values are the default and require no prefix.

    100 ' Decimal value 100
    %100 ' Binary value for decimal 4
    $100 ' Hexadecimal value for decimal 256
    Last edited by SteveB; - 9th June 2006 at 16:03.

  3. #3
    thibaud's Avatar
    thibaud Guest


    Did you find this post helpful? Yes | No

    Default hex

    Yes Steve but,

    I tried in the code to put

    b = $AE

    and it gives a compile error ????
    How should it be:

  4. #4
    thibaud's Avatar
    thibaud Guest


    Did you find this post helpful? Yes | No

    Default hex

    my zigbee expects to see the following:

    byte 1: 0x7E

    how to configure this in my code ????

  5. #5
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    There really isn't anything to configure. All of the below options will give you the same results. 0x7E is just the hex value 7E or Decimal 126. You can use the ASCII chart in the back of the manual. Also I find the following link to MELabs helpfull. http://www.melabs.com/resources/convert.htm

    Variables
    Byte1 var $7E, Byte1 var 126, Byte1 var "~", Byte1 var %01111110

    Constants:
    Byte1 con $7E, Byte1 con 126, Byte1 con "~", Byte1 con %01111110

  6. #6
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by thibaud
    I tried in the code to put

    Code:
    b = $AE
    and it gives a compile error ????
    Exactly what error does it give you? That will help a lot in determining the actually error. It certianly ins't just because you used:

    Code:
    b = $AE
    Instead of
    Code:
    b = 174
    or
    Code:
    b = %10101110
    Steve

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    may i guess that b wasn't previoulsy defined as a byte or word and it returned a Syntax error?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    thibaud's Avatar
    thibaud Guest


    Did you find this post helpful? Yes | No

    Default hex

    b = $7E 'line 15

    debug $7E


    I get a ERROR Line 15: Syntax error. (API.pbp)

Similar Threads

  1. Replies: 6
    Last Post: - 19th April 2007, 04:06

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