i2c PBP questions


Closed Thread
Results 1 to 15 of 15

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Try this one, it's working here
    Code:
    define LOADER_USED 1
    disable debug
    Data_READ   var byte
    Data_Write  var byte
    Bad         var bit
    ADDR        var word
    SDA         var PORTC.4
    SCL         var PORTC.3
    Control     con $A0
    
    Bad = 0
    
    Start:
        For addr=0 to $FFFF
            
            data_write=addr.lowbyte
            bad = 0
            I2CWRITE sda,scl,control,ADDR,[data_write]
            PAUSE 10 
    
            I2CREAD sda,scl,control,ADDR,[Data_read]
            enable debug
                data_read=data_read ' refresh ICD display
            disable debug
            if data_read != data_write then bad=bad +1
    
            next
        GOTO Start
    Last edited by mister_e; - 2nd February 2007 at 04:09.
    Steve

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

  2. #2
    Join Date
    Jan 2007
    Location
    Toronto
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    Hi Steve:

    Thanks for posting the code. How long should this take to complete? I can see that it is cycling through addresses 0 to $FFFF. I put in a line between the next and GOTO Start to light up one of the status LEDs I have on the board.

    It is not lighting up. In the watch window, Data_READ is blank. When I pause the program, I am in the library PBPPIC14.LIB stuck in the PAUSE routine waiting for the carry bit to be cleared. This bit does not get cleared.

    I just thought of something. I have no includes in my program as I normally did with assembler. I am just starting out with PBP.

    Am I perhaps not adding some includes that I need?

    I didn't see a list in the manual anywhere of any special requirements that have to be in the code. I don't have a device include either.

    Please advise


    Thanks

    Tim

Similar Threads

  1. explanation on I2C command (PBP)
    By F1CHF in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 12th May 2014, 06:30
  2. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 23:31
  3. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 22:07
  4. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 20:33
  5. Still new to PicBasic - i2c questions
    By cometboy in forum mel PIC BASIC
    Replies: 4
    Last Post: - 13th November 2006, 19:27

Members who have read this thread : 1

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