- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone. I'm working on an attendance system project; where the system reads number form an RFID tag and also gets the time the user clocks in. The issue right now is the rtc is not displaying time on the terminal emulator program but invalid characters. I really don't know what it is i'm doing wrong. Anyone with idea(s) on what might be wrong should please help me out.
Solved! Go to Solution.
- Labels:
-
PSoC 4 Architecture
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
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.
Thanks,
P Yugandhar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
I2C_MasterWriteBuf(SlaveAddress,DataPtr,Count,I2C_MODE_COMPLETE_XFER);
Reading from Slave sending register/command byte first:
I2C_MasterWriteBuf(SlaveAddress,&RegAddress,1,I2C_MODE_NO_STOP);
I2C_MasterReadBuf(SlaveAddress,DataPtr,Count,I2C_MODE_REPEAT_START);
... and always check the returned state (at least while debugging).
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks alot Bob. I will make the necessary corrections and give you feedback.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello Bob.
I've changed the SlaveAddress to 0x60 and used the API in the order you listed above but the time is still not displaying.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sorry i meant 0x68 for the slaveAdress
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
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.
Thanks,
P Yugandhar.