I have NXP PCA2129 RTC. I want to configure Alarm. I have following questions:
- I want to configure only Hour alarm and want to wake up after every 2 hours.
* What (time) should I set in Hour_Alarm register?
* Is it simply 2? and then RTC will generate INTERRUPT after 2 hours from the current time?
* OR Is it read current time and add +2 hours with current time at the event of sleep? It is not clear for me from data sheet.
- What is the Year, month, day and time set in factory manufactured RTC out at door?
There is not a sample source for this RTC per se. If you tell me what microcontroller you are using I can check to see if the SDK has an example that may help you.
I am using SPC5643L. Also My question is as follows:
I have set up minute alarm at X min. The alarm happen, sets AF. Now I want to clear AF and also want to clear Alarm Minute Register,
Now AF flag has to be cleared from Control 2 register address 01h and Alarm Minute Register address 0Bh. While clearing should I send address for control 2 register and send AF clear command and then how to clear Alarm Minute Register, Because data sheet says RTC by self increment of register. How to handle this clearing situation?
Do we need to perform in 2 step, first clear AF by sending control 2 address and then in step 2 clear Alarm Minute Register by sending Alarm Minute register address?
How to get this done in 1 step and what address to send? How to get only respective register impacted?
I am able to set alarm and generate AF and then I am able to clear AF as well. However above are few queries.
I've checked if there are any example codes for the RTC with the SPC5643L and there is not, I do apologize for the inconvenience this may cause you.
In regards to your question:
also want to clear Alarm Minute Register
What do you mean clear the Alarm Minute Register?
A) Do you want to disable it, so it no longer produces an alarm at any value?
B) Do you want to reset the alarm minute to a different value?
A) If you want to disable it, you can handle this in the same control register as AF. You may clear AF and AIE at the same time.
The AIE bit controls if an interrupt is generated or not from all alarm flags (you will disable all other alarm flags such a s hours, seconds, day and weekday).
If you want to disable only the minute alarm flag then it is the AE_M bit. This will be two steps since they are in different addresses. First clear AF then set AE_M to disable.
B) If you want to reset the value to something different, you must access the register and write a different value to the minute register. So this will be two steps, first clear the AF then access the minute alarm register to write a new a value.
If you do not need a new value, but you want the alarm to be triggered again, then you only need to clear AF. Then alarm will be triggered when the clock has the same value in its minute register.
To answer your questions:
As per the datasheet, any register that has a bit marked with an "X" is undefined. This means that there may or may not be a value pre-set, but once you configure this you will set its initial value.
No, there is not any particular flag that states whether it has been read for the first time or not. Essentially once you power it on and configure it, the values will be unchanged with any resets following. If you need to reconfigure it, only then the values should change.
Remember, as I mentioned before the initial values in the registes are undefined. This means that it is not guaranteed whether the registers have specific 1's or 0's in their bit fields.