chipKIT® Development Platform

Inspired by Arduino™

Problem with RTCC dayOfWeek

Created Thu, 13 Nov 2014 06:34:27 +0000 by NWTweety


NWTweety

Thu, 13 Nov 2014 06:34:27 +0000

I am trying to use RTCC with an Uno32 board. I am using UECIDE for my programming. I have no problems with RTCC.hour(value) or any of the others except dayOfWeek. Every time I try to compile with a "RTCC.dayOfWeek (value);" statement I get a compiler error. The error I get is "expected unqualified-id before '(' token". If I change dayOfWeek to any other call it compiles without error. My code is as follows:

// Host event sync clock time handler void Event_Sync_Time () {
RTCC.hours(host_buffer[0]); RTCC.minutes(host_buffer[1]); RTCC.seconds(host_buffer[2]); }

// Host event sync clock date handler void Event_Sync_Date () {
RTCC.year(host_buffer[0]); RTCC.month(host_buffer[1]); RTCC.day(host_buffer[2]); RTCC.dayOfWeek(host_buffer[3]); }

host_buffer[] is set up to hold 6 values. Everything works except the last RTCC call. What am I doing wrong?

NWTweety


majenko

Thu, 13 Nov 2014 10:18:41 +0000

I can see nothing wrong, either with your code, or with RTCC. Which version of RTCC are you using? I.e., where did you download from?


NWTweety

Fri, 14 Nov 2014 02:01:09 +0000

I was using RTCC-r2 from sourceforge. I deleted it and loaded RTCC-Master from Github. Now I get more compiler errors along the lines of: " 'class RTCCClass' has no member named 'hours' " and the same for each of the other members.

Except for dayOfWeek. For that one I get the same compiler error as before: "expected unqualified-id before '(' token".

Any thoughts?

NWTweety


NWTweety

Fri, 14 Nov 2014 06:09:56 +0000

Problem solved.

I have gone back to RTCC-r2. The problem was #include <Time> and #include <TimeAlarm>. I had put these in before I decided to use the built-in clock. They seem to interfere with RTCC and aren't needed now. Now that they are removed, everything works.

Thanks for your reply. NWTweety


majenko

Fri, 14 Nov 2014 09:58:40 +0000

Ah yes, mixing and matching Time with RTCC would cause problems.

The version of RTCC on Sourceforge is ancient. You really should be using the Github version.

However, the github version works in a very different way - it abstracts the time from the device.

You access RTCC to get an "RTCCValue" object, and from that you can manipulate (get and set) the time.

The idea is that the same RTCCValue can be used with different clock systems with minimal changes. I am part way through writing a generic RTC class that replaces RTCC and encompasses other modules, like the Dallas chips.