1 Reply Latest reply on Jan 17, 2018 9:29 PM by anks

    PCF8583 how to read date and time :/

    sftwmail_2281841

      HI.

       

      Sorry but my english is little, and I started witch psoc ...    how to correctly read data from pcf8583 ???

       


      #include "project.h"
      #include "tm1637.h"
      //#define PCF8583_ADDR 0xA0        // gdy A1 --> GND
      #define PCF8583_ADDR 0xA2        // gdy A1 --> VCC
      uint8 czas[4];
      uint8 ss=4, mm=3, hh=2, day, month;
      //==================================================================================================================================
      //==================================================================================================================================
      int main(void),
      {
          CyGlobalIntEnable; /* Enable global interrupts. */
          I2C_1_Start();
          /* Place your initialization/startup code here (e.g. MyInst_Start()) */
          
          
          
            
          
          for(;;)
          {
          SENDnumber(4523);                       //TM1637
              
          I2C_1_MasterSendStart(PCF8583_ADDR, 0);
          I2C_1_MasterWriteByte( PCF8583_ADDR );
          I2C_1_MasterWriteByte( 0x02 );
          I2C_1_MasterWriteByte( PCF8583_ADDR+1);
          I2C_1_MasterSendStart(PCF8583_ADDR, 0);
          ss = I2C_1_MasterReadByte(I2C_1_ACK_DATA);
          mm = I2C_1_MasterReadByte(I2C_1_NAK_DATA);
          I2C_1_MasterSendStop();
          
          
              
              
              
              
              SENDnumber( ss);
                 CyDelay(500);
              SENDnumber( mm );
                 CyDelay(500);
               SENDnumber( hh );
                 CyDelay(500);
              
          }
      

      }

       

       

          to check i2c function i used led and variable ct but the max val is 1 :/

       

      for(;;)
      
      {
      
      SENDnumber(ct++);                   
      //TM1637
      
      
      
      I2C_1_MasterSendStart(PCF8583_ADDR, 0);
      
      SENDnumber(ct++);                   
      //TM1637
      
      I2C_1_MasterWriteByte( PCF8583_ADDR );
      
      SENDnumber(ct++);                   
      //TM1637
      
      I2C_1_MasterWriteByte( 0x02 );
      
      SENDnumber(ct++);                   
      //TM1637