Shop OBEX P1 Docs P2 Docs Learn Events
Using the Chronodot (RTC) using C — Parallax Forums

Using the Chronodot (RTC) using C

I'm trying to use the Maxim DS3231SN RTC (Chronodot) with the Prop using C.

I know my circuit configuration is correct since I have successfully used Mike Green's Spin i2cObject_v2_1 to access the Chronodot (DS3231 registers are close to the DS1307).

When I run the attached code, the i2c_in() return value (bytesRead) is always 0.

Any suggestions / feedback would be most welcome.

Here is my source code:
#include "simpletools.h"

i2c *eeBus;

int main()
{
  eeBus = i2c_newbus(28,29,0);

  int timeData[12] = {0,0,0}; 

  int bytesRead = i2c_in(eeBus,0b1101000,0,1,timeData,3); 

  print("Bytes Read: %d\n", bytesRead);
  
  for (int index = 0; index < 3; index++)
    print("timeData[%d] = %d \n", index, timeData[index]);       
}
Sign In or Register to comment.