I'm successfully using DS3231 with uno but for very simple task of powering on/off a device on alarm match. My question is: Is it possible to program SQW output on DS3231 to behave like this?
Going High on AL1 and Low on AL2
By reading datasheet I'd say it isn't possible as SQW outputs predefault frequencies or, in interrupt mode it generates interrupts on any alarm match, but is there maybe something I am missing?
Is this above signal possible to achieve without micro controller with some logic/latch IC or controller is a must?
Im using this module
I believe that you can get the square wave/alarm interrupt pin to behave as you would like in response to alarm1 and alarm2. Some of what you can do will depend upon what library you are using or if you are comfortable doing direct reads/writes to the control registers.
The key point, is that the alarm status flags are independent of the interrupt level, and the interrupt level is only dropped when the alarm status flag is cleared. Basically, you will need to monitor the alarm status flags as well as the interrupt pin, and control the interrupt pin based on the flags.
If you do not clear the alarm1 status flag, the pulse will stay high. You will then only be able to detect the alarm2 by checking the alarm2 status flag, and not the interrupt pin. When the alarm2 flag is set, then you can clear both alarm1 and alarm2 which will drop the interrupt pin.
As to you second point about using the module without a microcontroller....I have no clue.
Thank you cattledog.
When INTCN is set to logic 1, then a match between the timekeeping
registers and either of the alarm registers activates the INT/SQW pin
If I'm getting this one right from the datasheet this means that I will have interrupts during one second for AL1 and during full minute for AL2 as it doesn't have seconds resolution like AL1
In addition to this it also confuses me what is meant by "activates the INT/SQW pin" ?
Does it mean I will have single interrupt pulse lasting 1 sec or 1 min in case AL2 or I will have 400kHz interrupts during that time, since this is the I2C bus clock
....It would be good to have oscilloscope to check this...
When the int/sqw pin goes high on a match, it will stay high until the alarm status flag is reset. Some libraries will reset reset the flag automatically when it is read. Do some experimenting. Put a digital read on the sqw/int pin, trigger an alarm, and keep reading the pin. You should see it continue to stay high.
This pin is not an interrupt in the sense that it is often used for Arduino interrupts, but you can read modules swq/int pin with an Aduino interrupt and read the rising edge.
So conclusion is that once triggered by alarm SQW in interrupt mode will stay high forever unless status flag is cleared which can be done only over I2C bus, so => no DS3231 use without microcontroller?