greetings. i have available 1302 and 1305(of which i would like to use 1305). i looked through the posts here and found this Arduino Forum but i dont understand exactly whats going on in some parts. the code im trying to use works on other spi devices and im not getting anything on the 1305 ive setup. ive tied SERMODE to +5 to indicate spi mode, vice 3wire, and grounded all unused power pins as per the datasheet. i know these are old parts but im not able to get a 1307 or any other rtc for that matter. i need to use what i have. plus im having trouble with i2c which is another topic.
#include <SPI.h>
#define ss 10//ss
void setup() {
SPI.begin();
digitalWrite(ss,LOW);
pinMode(ss,OUTPUT);
SPI.setClockDivider(SPI_CLOCK_DIV16);
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE1);
Serial.begin(9600);
digitalWrite(ss,HIGH);
SPI.transfer(0x0F>>8);
SPI.transfer(0x0F);
byte r=SPI.transfer(0);
digitalWrite(ss,LOW);
Serial.println(r, BIN);
}
void loop() {
}
i get a 128 returned from this. ive tried the code from the other post with the suggested fixes and get nada also. any insight? or better yet anyone have a simple to understand sketch, either transfering one byte at a time or burst mode read with lots of comments. thank you. also with the 1302 which i would use, im not understanding the read, of which im sure is the simplest thing im missing. i would like to move on to other sensors, but an rtc is paramount i think in any project. my robot will never take over the world if he cant at least tell time.
http://datasheets.maximintegrated.com/en/ds/DS1305.pdf
also interested in using epoch to store timestamp, i see alot of posts using this method, some suggestions from ppl, but no real instructions on setting it up and executing it. thank you.