The Designer's Guide Community
Forum
Models in Minutes
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines. Dec 16th, 2018, 12:04am
  HomeHelpSearchLoginRegisterPM to admin  
 
Pages: 1
Send Topic Print
How to find out a way to deactivate the alarm that is already set please? (Read 330 times)
sunrise7747
New Member
*
Offline



Posts: 3

How to find out a way to deactivate the alarm that is already set please?
Apr 12th, 2018, 2:33am
 
Hi friends, Cheesy
I interfaced DS3231 RTC to Atmega328, the datasheet of DS3231 see http://www.kynix.com/uploadfiles/pdf0125/DS3231M2bTRL.pdf

I am not able to find out a way to deactivate the alarm that is already set.
In register 0x0E, AxIE is used to enable/disable the interrupt. INTCN is used to control the interrupt/ square wave.
In register 0x0F, AxF bits indicate whether alarm flag is set or not. We can only clear the flag if it is set.
A1M1 to A1M4 are used to set alarm rate.

So in case I already set alarm and want to cancel, what should be done? Because of this, I do not think I can read the status whether alarm is set or not. I guess we need to have one more register to keep track of enable/disable alarms.



I do not want to use INT/SQW pin (that can be attached to Pin change or external interrupt), but I want to read the A1F/A2F flags periodically in my software and then raise alarm accordingly. I agree that we could always read the time value from the RTC chip and compare in software. But since there is a feature in RTC chip, I thought I can use it.

Assume that I want to go to "alarm set" mode in my system. In that mode, I display the current values of the alarm registers (Hours and Mins) and also the current state of alarm (whether ON or OFF). So to do this, I want to use DS3231 itself and read and display current values instead of making use of locally stored data. Another case if I want to cancel the alarm that may be set accidentally. 

After some tests, I observed that if we do not use interrupt, A1IE/A2IE bit is of no use. These two flags can be set or reset by the application software, but they do not get updated by alarm status flags. A1IE Enable/Disable does not impact the alarm flag. 
datasheet does not talk about default values on start up it looks. So I am clearing A1F/A2F during processor start up. But I am not sure what happens  to A1F/A2F when periodic alarm is enabled using A1M1 to A1M4 bits. I tried once, but found that if we clear, they do not get set again even if repeat option is enabled. Not sure how the behavior is when repeat  is opted.

To conclude: Alarm cannot be disabled in chip once it is written (undo option is not there). Software has to take care of this keeping local enable/disable flag. Right? Any thought?

Thanks in advance and Regards!
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Trouble viewing this site? Copyright © 2002-2018 Designer's Guide Consulting. 'Designer's Guide' is a registered trademark of Designer's Guide LLC. All rights reserved.

Our colleges are not as safe as they seem. Sexual assault is pervasive and the treatment of the victim by the adminstration is often as damaging as the assault: Campus Survivors, Campus Survivors Forum.

Some of our other sites that you might find useful: Avendesora, Inform and QuantiPhy.