DS1302 WriteRam
![hmlittle59](https://forums.parallax.com/uploads/userpics/199/nCR6ABWFQF1HY.jpg)
Hello All,
I want to be sure about what I doing here. Do I need to "CLEAR" the write protect Bit when writing DATA to the RAM location? The documentation does not really say unless I just missed it. I tried it in my test program and then removed it and it still worked, so I'm going to assume its not needed. thanks.
SET Clock time:
1) Clear Write Protect
2) Set time
3) Set Write Protect
WriteRAM:
1) Set up location
2) Write data
3) done
no Clear or set of any Bits
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I HAVE LEARN SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
I want to be sure about what I doing here. Do I need to "CLEAR" the write protect Bit when writing DATA to the RAM location? The documentation does not really say unless I just missed it. I tried it in my test program and then removed it and it still worked, so I'm going to assume its not needed. thanks.
SET Clock time:
1) Clear Write Protect
2) Set time
3) Set Write Protect
WriteRAM:
1) Set up location
2) Write data
3) done
no Clear or set of any Bits
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I HAVE LEARN SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
Comments
Bit 7 of the control register is the write protect bit. The
first seven bits (bits 0 – 6) are forced to zero and will
always read a zero when read. Before any write operation
to the clock or RAM, bit 7 must be zero. When high,
the write protect bit prevents a write operation to any
other register. The initial power on state is not defined.
Therefore the WP bit should be cleared before attempting
to write to the device.
In my own applications I clear it before doing writes and set it after, just in case the power gets cut suddenly and things get into a weird state.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
I'll have to put it back in my code. Don't know why it was working without it unless it was never (SET) from the first time during my testing.
thanks again
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I HAVE LEARN SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering