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 char

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
NaAd_4382031
Level 1
Level 1

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.

0 Likes
1 Solution

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.

View solution in original post

0 Likes
10 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes

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.

0 Likes

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.

0 Likes

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

0 Likes

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?

0 Likes

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

0 Likes

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.

0 Likes