I2CRead control value


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382

    Default I2CRead control value

    I'm currently using the following:

    EEPromIndex var WORD

    EEPromIndex=0
    I2CRead SDA,SCL,rddev,EEPromIndex,[NextCard.HighByte,NextCard.LowByte]

    One would think you could use the following w/o the variable and get the same results:

    I2CRead SDA,SCL,rddev,0,[NextCard.HighByte,NextCard.LowByte]

    However the program stalls out at that line if I go without the variable. Thoughts?

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    DynamoBen, It is probably because the immediate declaration of "0" is sized for 8 bits or 1 byte, as opposed to using the variable which is declared as a word for the eeprom addressing. That is why one should be carefull when using constants instead of variables.

    Dave Purola,
    N8NTA

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    A word sized variable, even when it contains a value of 0, is still a 16-bit
    value. PBP just clocks out 16 0's instead of 8.

    Using an inline or direct value of 0 as the address argument with I2CRead
    PBP is most likely interpreting this as an 8-bit address value, and clocking
    out only 1/2 the required number of bits for the EEPROM address.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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


    Did you find this post helpful? Yes | No

    Default

    I guess the variable stays then.

Similar Threads

  1. How do I give a radio control car autonomous control
    By Kenjones1935 in forum General
    Replies: 190
    Last Post: - 17th January 2010, 15:40
  2. pt2258+16f877 how can i use for 5.1 volume control ?
    By whyliving in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th January 2008, 17:51
  3. No one-way approach to learning ir remote control frequencies
    By selbstdual in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 22nd June 2007, 13:26
  4. PFC8583 Connection and I2Cwrite I2cread!
    By uludere72 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 27th February 2006, 13:32
  5. Control RC servo via Parallax Servo Control
    By cibotsan in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th September 2005, 08:18

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