- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 |
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
RTC Example Code in C, BASIC and Pascal for PIC, dsPIC, and AVR, e.g. mikroC-PIC, mikroC-dsPIC, mikroC-AVR.
Please see the mikroC-AVR for RTC read and write
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
RTC Example Code in C, BASIC and Pascal for PIC, dsPIC, and AVR, e.g. mikroC-PIC, mikroC-dsPIC, mikroC-AVR.
Please see the mikroC-AVR for RTC read and write