Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

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
0 Likes
1 Solution
AnkitaS_51
Employee

Please see the mikroC-AVR     for RTC read and write

View solution in original post

1 Reply
AnkitaS_51
Employee

Please see the mikroC-AVR     for RTC read and write

View solution in original post