Where do you get the time from? Which format?? What time conversions do you perform???
Can you please post your complete project or a shortened version that shows the error so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
I later discovered that i'm using the internal and external RTC when i meant to use just the external one. I changed the code to work for external RTC with 24 hours format. To convert the time i'm adding 0x30 to each register bytes but it's just returning 0. Attached Below is the complete code.
I later discovered that i'm using the internal and external RTC when i meant to use just the external one. I changed the code to work for external RTC with 24 hours format. To convert the time i'm adding 0x30 to each register bytes but it's just displaying 0 on HTerm. Attached Below is the complete code.
Your RTC_slaveaddress is wrong. You #defined a binary value but did not specify 0b.
Probably the EEPROM_slaveaddress is also wrong. SPI addresses are 7 bit wide, so 0xa0 is wrong.
Keep in mind that most of the APIs (except those for reading a byte) return a status byte which, when non-zero indicate an error condition.
thank you Bob. I just checked the file i sent and i noticed it include the old codes. the one i'm using now is attedSystemNew. And should the RTC_slaveaddress have been 0x68?
Yes, 0x68 is a correct address.
Next bug is the SendStart() before the ReadBuf(). Use for the mode parameter I2C_MODE_COMPLETE_XFER and all will be well.
The high-level APIs must be used in this way:
Writing to slave Count bytes
Reading from Slave sending register/command byte first:
... and always check the returned state (at least while debugging).
Thanks alot Bob. I will make the necessary corrections and give you feedback.
I've changed the SlaveAddress to 0x60 and used the API in the order you listed above but the time is still not displaying.
sorry i meant 0x68 for the slaveAdress
Please refer to the code example "I2C_SCB_MASTER" and "I2C_SCB_SLAVE" projects in the PSoC Creator which demonstrates the basic usage of the PSoC 4 Serial Communication Block (SCB) Component in I2C Master and I2C Slave modes.