zs 042 module seconds out?

Satchid

Member
Hi,
I Have purchased a "zs 042" module (based on a ds3231). I need a secondpulse ou or a minute pulse out. Is there someone that knows a method of doing this a simple as posible. I need the second puls at pin c.4 of a picaxe 14m2.

Thank you

Willy
 

hippy

Ex-Staff (retired)
Read the I2C seconds register, if different to what was previously read then output a pulse. Something like ...

Code:
lastSeconds = 99
Do
  Hi2Cin SECONDS_ADR, ( seconds )
  If seconds <> lastSeconds Then
    PulsOut C.4, 1000
    lastSeconds = seconds
  End If
Loop
 

Satchid

Member
Thank you Hippy forr the fast responce,

but Yesterday I was searching the net and found the following PDF. It seems that a "seconds" pulse can be taken directly from the sqw output on the zs-042 after reprograming the output.

In the case as described in the pdf it is done with an Arduino, but is this also possible with a picaxe and how? It seems that it needs only reprogramming the zs-042 once to set the sqw output to 1Hz. This way I need only 1 + grnd pin input on the picaxe instead of 2 for the I2C wires.

Here is the PDF. the 2 last blocks are relevant. I could not coppy/past them.

http://www.rinkydinkelectronics.com/resource/DS3231/DS3231.pdf

If the above is at all posible, Could you help me with this pls?

Sorry for my english, i can not always write it as i like to.

Willy
 

hippy

Ex-Staff (retired)
Untested, but this should set the DS3231 SQW output to 1Hz -

Code:
Symbol CTRL_ADR       = $0E

Symbol CTRL_ADR_EOSC  = bit7
Symbol CTRL_ADR_BBSQW = bit6
Symbol CTRL_ADR_CONV  = bit5
Symbol CTRL_ADR_RS2   = bit4
Symbol CTRL_ADR_RS1   = bit3
Symbol CTRL_ADR_INTCN = bit2
Symbol CTRL_ADR_A2IE  = bit1
Symbol CTRL_ADR_A1IE  = bit0

CTRL_ADR_EOSC  = 0 ; 0 = Enable oscillator
CTRL_ADR_BBSQW = 0 ; 0 = No SQW output when on battery
CTRL_ADR_CONV  = 0 ; 0 = No TXCO adjustment
CTRL_ADR_RS2   = 0 ; 0 = 1Hz
CTRL_ADR_RS1   = 1 ; 1 = 1Hz
CTRL_ADR_INTCN = 0 ; 0 = Output SQW
CTRL_ADR_A2IE  = 0 ; 0 = No Alarm 2 interrupt
CTRL_ADR_A1IE  = 0 ; 0 = No Alarm 1 interrupt

HI2cOut CTRL_ADR, ( b0 )
Or

Code:
HI2cOut $0E, ( %00001000 )
Note that if you do not have the two I2C SDA and SCL lines connected you will likely have to remove the DS3231 to reprogram it should its battery go flat.
 
Top