Problem with PCF8583 + Arduino M0

Hi everyone,

I´m trying to do a simple datalogger that records 3 sensors valules in a SD. I also need to storage the date and time so I decided to use a PCF8583 module (RTC Click)

I´m using the PCF8583.h library that already exists, but I needed to adapt it because it didn´t compile. (I had to change Wire.write(0x00) by Wire.write(bytte(0x00)))
The program compiles but when I load it to the arduino the COM port disappears and I don´t know why.
This happens every time I use the PCF8583 library, even in the example, and the program doesn´t do anything.

Does anyone know why that happens? Any way to solve that?

Many thanks!

Are you using this library? it is tested against the M0 (ATSAM21D)

No, I am using this one, because my device is PCF8583, but I will try using that one. In that one the device defined is PCF8523, will it work as the 8583?

Thanks!

what’s your exact pb with that library? Wire.write(0x00) should be legit.

which version of the IDE do you use? where did you get it from?

I compiled your library without any issue by just adding const in the .h for that line and the type to be int8_t (because char is unclear about -1)

[color=green]const static int8_t [/color]PROGMEM MonthTable[24] = {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5, [color=red]-1[/color], 2, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5};

(in the .h you might also need to change#include <../Wire/Wire.h>into#include <Wire.h> depending on where you install that code)

I am using the 1.7.11 IDE from arduino.org, the indicated one for arduino M0.
When I try to compile the PCF8583 library with the changes you mention it keeps me showing an error in the Wire.write(0x00) sentence.
Doing the changes I told you (byte(0x00)), it compiles but the program doesn´t do anything and the COM port disappears.

With the other library (RTClib.h) I have been able to make it run but it shows me 2165/165/165 165:165:85. I have been reading about it and most people say that it´s because of an connection error, but the device is right connected.

Thanks for your answers

Finally I solved the "165" problem. I made an I2C Scanner and I realized that my I2C address was 0x50 instead of 0x68 defined by RTClib.h. Now, I can set the hour by the PC hour but it increase very slowly, only 1 second in 30 seconds time, may it be due to the battery?

Many thanks

The IDE from arduino.org is known of having some issue, suggest you get the one from https://www.arduino.cc/en/Main/Software

I use the arduino.org one because the 1.7.11 IDE is the indicated for my Arduino M0 board. With the 1.6.12 IDE (The one in arduino.cc) it is not contemplated the arduino M0.

By the way, I have been able to make it run with this other library. In this one PCF8583, which is my device, is included.

The RTC runs right but it shows the year 2208 ans I have no idea why. The only thing that comes to my mind is rest 192 to the year value and pray that this 192 difference will be always the same... but it´s quite dirty :cold_sweat: