+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Newbie level 2
    Points: 1,650, Level: 9

    Join Date
    Nov 2003
    Posts
    2
    Helped
    0 / 0
    Points
    1,650
    Level
    9

    I2CREAD HELP

    I WRITE A PROGRAM TO DO A COMUNICATION ,USING I2C BUS AND 2 PIC16F876..
    THE SLAVE USE ASSEMBLER,AND I THINK IS O.K.
    THE MASTER USE PICBASICPRO,AND CAN'T RECEIVE THE DATA.
    I USE THIS CONFIGURATION:

    DEFINE HSER_BAUD 19200
    DEFINE I2C_SLOW 1
    DEFINE ONINT_USED 1 ' BOOTLOADER
    SCL VAR PORTC.3 ' Clock pin
    SDA VAR PORTC.4 ' Data pin
    FromSlave VAR BYTE 'dati arrivati dallo Slave
    Letture VAR BYTE ' Dati letti da ADC (funzione non implementata)
    Test VAR PORTA.0
    SSPCON= %00101000 ' Setta il dispositivo in Master Mode
    SSPADD= %00001001 ' 100KHz con Fosc 4MHz
    PORTA= 0
    TRISA= %11111110
    PORTB=0
    TRISB=0
    PORTC=0
    TRISC=%10111111
    FromSlave=0
    CICLO:

    I2CRead SDA,SCL,2,[FromSlave],ERRORE
    GoTo CICLO

    someone can tell how work I2CREAD??
    THANKS

    •   AltAdvertisement

        
       

  2. #2
    Full Member level 4
    Points: 4,651, Level: 16

    Join Date
    Nov 2001
    Posts
    236
    Helped
    9 / 9
    Points
    4,651
    Level
    16
    If something in C helps, look at:
    http://www.elektroda.pl/eboard/viewt...asc&highlight=


    HH
    NeuralC



    •   AltAdvertisement

        
       

  3. #3
    Advanced Member level 5
    Points: 16,636, Level: 31

    Join Date
    Jul 2001
    Location
    Oberon
    Posts
    1,897
    Helped
    442 / 442
    Points
    16,636
    Level
    31
    I dont know what code your basic compiler produces, but to read I2C, you send a start, then a write to the address, then a restart, and then a read.



    •   AltAdvertisement

        
       

  4. #4
    Advanced Member level 4
    Points: 11,937, Level: 26

    Join Date
    Jul 2001
    Posts
    1,059
    Helped
    93 / 93
    Points
    11,937
    Level
    26

    Re: I2CREAD HELP

    If you need to know how the I2C bus works here is a good document (the i2c standard):

    http://www.semiconductors.philips.co...8/39340011.pdf

    best regards



  5. #5
    Full Member level 1
    Points: 3,540, Level: 13

    Join Date
    Jul 2001
    Location
    Himalayas.(mount K2)
    Posts
    97
    Helped
    1 / 1
    Points
    3,540
    Level
    13

    Re: I2CREAD HELP

    Quote Originally Posted by Frank1313
    I WRITE A PROGRAM TO DO A COMUNICATION ,USING I2C BUS AND 2 PIC16F876..
    THE SLAVE USE ASSEMBLER,AND I THINK IS O.K.
    THE MASTER USE PICBASICPRO,AND CAN'T RECEIVE THE DATA.
    I USE THIS CONFIGURATION:

    DEFINE HSER_BAUD 19200
    DEFINE I2C_SLOW 1
    DEFINE ONINT_USED 1 ' BOOTLOADER
    SCL VAR PORTC.3 ' Clock pin
    SDA VAR PORTC.4 ' Data pin
    FromSlave VAR BYTE 'dati arrivati dallo Slave
    Letture VAR BYTE ' Dati letti da ADC (funzione non implementata)
    Test VAR PORTA.0
    SSPCON= %00101000 ' Setta il dispositivo in Master Mode
    SSPADD= %00001001 ' 100KHz con Fosc 4MHz
    PORTA= 0
    TRISA= %11111110
    PORTB=0
    TRISB=0
    PORTC=0
    TRISC=%10111111
    FromSlave=0
    CICLO:

    I2CRead SDA,SCL,2,[FromSlave],ERRORE
    GoTo CICLO

    someone can tell how work I2CREAD??
    THANKS
    Frank I am planing to do similar but not have tried yet . I have seen melabs site and there are codes for doing this tak go run and find em there and do tellus if that worked ?


    Ts



--[[ ]]--