I2CRead & I2CWrite not working as expected


Results 1 to 31 of 31

Threaded View

  1. #16
    Join Date
    May 2013
    Location
    australia
    Posts
    2,695


    Did you find this post helpful? Yes | No

    Default Re: I2CRead & I2CWrite not working as expected

    yet still another pointless snippet , with nothing defined


    I2CREAD DPIN,CPIN,$A0,B0,X

    you persist in using incorrect syntax , it should be

    I2CREAD DPIN,CPIN,$A0,B0,[X ]



    proper code, not snippet with undefined rubbish, its not hard
    Code:
    #CONFIG             __config        _CONFIG1,    _FOSC_INTOSC & _CP_OFF & _WDTE_OFF &  _PWRTE_ON  &  _MCLRE_ON  & _CLKOUTEN_OFF
                  __config      _CONFIG2, _PLLEN_ON & _LVP_OFF
    #ENDCONFIG
    ;pic16f1825
    
    DEFINE OSC 32
    OSCCON=$70
    ANSELA=0
    ANSELC=0
    trisa.0=0
    DEFINE I2C_SLOW 1 
    ANSELA = 0
    a Var Byte
    addr Var word
    ar Var Byte
    
    
    SCL var Porta.2                     
    SDA var Porta.1
    lata.0=1
    DEFINE DEBUG_REG PORTA
    DEFINE DEBUG_BIT 0      ;  if not used for pwr  
    DEFINE DEBUG_BAUD 9600
    DEFINE DEBUG_MODE 0     
    pause 2000
    Debug 13,10,"Start",13 ,10
    
    
    a=20
    addr=$200
    I2cwrite Sda,SCL,$a0 ,addr,[a]
    pause 10
    
    
    addr=$200
    I2CREAD Sda,SCL,$a0 ,addr,[ar ]
    debug 13,10,sdec ar
    end
    what a write looks like

    Name:  write.jpg
Views: 15358
Size:  73.7 KB

    what a read looks like

    Name:  read.jpg
Views: 15629
Size:  90.7 KB
    Last edited by richard; - 9th October 2021 at 10:18.
    Warning I'm not a teacher

Similar Threads

  1. I2cwrite - I2cread
    By savnik in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 5th July 2006, 02:12
  2. Problem with I2Cread and I2CWRITE function
    By Tony85 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th June 2006, 21:03
  3. Problem with I2Cread and I2CWRITE function
    By Tony85 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th June 2006, 19:32
  4. PFC8583 Connection and I2Cwrite I2cread!
    By uludere72 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 27th February 2006, 14:32
  5. I2CWRITE and I2CREAD
    By Tomas in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd April 2004, 03:30

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