Connect with us

Problem with I2C programmings .. PLZ Help

Discussion in 'Microcontrollers, Programming and IoT' started by mot1639, Mar 20, 2011.

Scroll to continue with content
  1. mot1639

    mot1639

    4
    0
    Mar 6, 2011
    Hi All ,, i need you help as soon as possible ..

    now i have PIC16f877a with a development Kit from MIKROC company. also I have SI-598 from Silicon labs ... this is a XO component. now I need to change this XO frequency. i should communicate with it with PIC16f by SPI interface ... i make a SPI interface ... i coonect the SI-598 with power supplay and from frequency reader it work ..

    now in the programming i do ...

    Code:
    void main(){
      PORTB = 0;
      TRISB = 0;              // Configure PORTB as output
    PORTB = ~PORTB    //....................1................
      I2C_Init(100000);      // initialize I2C communication
      I2C_Start();           // issue I2C start signal
    PORTB = ~PORTB    //....................2................
      I2C_Wr(0x55);          // send byte via I2C  (device address + W)
    PORTB = ~PORTB    //....................3................
      I2C_Wr(8);             // send byte (address of EEPROM location)
      I2C_Wr(0x08);          // send data (data to be written)
      I2C_Stop();            // issue I2C stop signal
    }
    
    
    i compile it and every thing go fine .. after that i download it in PIC16f
    now in .....1..... in the code, will turn ON all the LED connect to PORT B . (work)
    again i ...2.... in the code , all the LED must turn Off ... (work)
    now the problem is the in ...3... in the code , the LED connect to POrtB must turn ON again but this command not work .... if i remove ((( I2C_Wr(0x55); )))) it will work..

    now why this command have a problem ((( I2C_Wr(0x55); ))) the 55 address it correct from datasheet


    please help me ..
     
    Last edited: Mar 20, 2011
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-