I know RTFM, but why?


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink PbP joker

    Hi, Jumper

    Having a look to various I2C Datasheets show Word DATAs are read an sent High byte first ...

    This simply could be the clever explanation you're looking for.

    Back to YOUR own problem ( I do not see the reason, yet : $0000 or $FFFF do not care of byte order ... ), a look at the manual, 4.17.10 section : REV function, could enlight a really fair solution ... consuming very little time.

    Alain

    PS : I'll use it for my variable array storage ... thanks a lot !!!
    Last edited by Acetronics2; - 22nd July 2006 at 10:37.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    Jumper,
    Why not solve your problem by always using the STR modifier? For a single word, just use something like:

    Code:
    a var word[8]
    I2CWRITE datapin,clockpin,control,(address),[STR a\1]
    .....
    I2CREAD datapin,clockpin,control,(address),[STR a\1]
    For X Words, use:
    Code:
    a var word[8]
    I2CWRITE datapin,clockpin,control,(address),[STR a\X]
    .....
    I2CREAD datapin,clockpin,control,(address),[STR a\X]
    This should keep you from having to think about which order the bytes are stored in.

    Steve

  3. #3
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default I will

    It seems to be a good idea as you point out to always use the STR function. Everybody sais that PbP has few bugs, I would like to call this a bug but since the manual mentions that the I2C command will return different data compared how variables are usually stored it has to be a feature :-)

    Thanks for taking time to think about this and if anyone ever find a reson why PBP has decided to go this way I still would like to know.

Similar Threads

  1. New version of Pic BASIC Pro released
    By Demon in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 12th March 2010, 16:41
  2. Using both DIV32 and LONGs together
    By BrianT in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th January 2009, 13:46
  3. 18F Config fuses
    By Angus Anderson in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 18th December 2007, 16:59
  4. How about a thread that replaces RTFM and RTFDataSheet:
    By blainecf in forum PBP Wish List
    Replies: 12
    Last Post: - 13th August 2007, 18:46
  5. Set bits of Word problem
    By pdegior in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 3rd September 2005, 23:44

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