I2C configuration


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Feb 2007
    Posts
    14

    Question I2C configuration

    since i got the PicBasicPro i have a hard time leaving it. Wanting to learn all i can. I have note left and right since i started.I appreciate the help from everyone but i have another question.

    I have searched for I2C config with no results that reallt explains what i want to know.

    I am working with the TC74a05 address 1001 101
    control = %1001101 <--------Is this declared by PicBasic Pro that i don't have too.
    addr = $00 <--------Is this declared by PicBasic Pro that i don't have too.
    i2cwrite sda,scl,control,addr,[$00]

    I have this device reading the temp. What i want learn is to write to the config area and put it in standby.

    The 7 bits of control are really the address of the chip with a r/w bit as the 8 bit but actuall bit0, correct? The addr is what? and the [$00] is the data to write? Do i have to do 2 write commands to do a configure?

    The documentation says.

    Is this the [$00]?

    Command Code Function
    RTR 00h Read Temperature (TEMP)
    RWCR 01h Read/Write Configuration

    Where does this go? In the Addr area?

    CONFIGURATION REGISTER
    (CONFIG); 8 BITS, READ/
    WRITE)
    D[7] 0 STANDBY Switch Read/Write
    1 = standby,
    0 = normal

    D[6] 0 Data Ready * Read Only
    1 = ready
    0 = not ready

    D[5]-D[0]
    Reserved -
    Always
    returns zero
    when read

  2. #2
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Red face

    You have to shift the I2C-adress to the left by 1 bit.
    So you get %10011010 as the adress.

    I know, it is only very bad written in the manual, but ...
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  3. #3
    Join Date
    Feb 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Question

    The addr is what? and the [$00] is the data to write? Do i have to do 2 write commands to do a configure?

  4. #4
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Cool

    Sorry,

    in your words, the I2C-adress is the control-word.

    So you have to change the single line
    control = %1001101 <--------Is this declared by PicBasic Pro that i don't have too.

    to

    control = %10011010 <--------Is this declared by PicBasic Pro that i don't have too.
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  5. #5
    Join Date
    Feb 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Talking

    Thank you Big Wumpus for the help and replys.

    Merlin Knight

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 22:31
  2. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  3. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 19:33
  4. I2C slave
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th March 2008, 03:46
  5. Please help with i2cslave i2c slave
    By cycle_girl in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st December 2005, 13:55

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