- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
what is use of two API
RTC_SetAlarmMask()
RTC_GetAlarmMask()
actually I am trying to compare current time and alarm time. If alarm time and current time match ,alarm occur. If both time does not match , no alarm occur. I am not sure but I think I have to use RTC_GetAlarmMask(). so that we can compare both time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The mask is to determine what portions of date/time you want to
use to create alarm. Like month day year, mask allows you to use
all for the alarm, or just month or just day year or......
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
when I need to get time and date from RTC. I write following statement
uint32 time;
uint32 date;
/* Get Date and Time from RTC */
time = RTC_GetTime();
date = RTC_GetDate();
I don't want to use two API , I just want to use one RTC_GetDateAndTime() to get current time and date
how to replace that API with RTC_GetDateAndTime() ? and also What I have to do to get alarm time and date ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The datasheet explains the parameter that RTC_GetDateAndTime() requires: A pointer to (address of) a structure RTC_DATE_TIME which you must provide. Same applies to RTC_GetAlarmDateAndTime(). Have a look into the datasheet under "Data Structures" to see the members of the struct. Help for accessing structs is here.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not quite right. The structure is already declared you only need to define a variable of that type as
struct RTC_DATE_TIME MyDateTime;
Using the pre-defined structure saves you from errors in the case of API or structure changes in future component updates.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
int main()
{
uint32 time;
uint32 date;
uint32 alarm;
while(1)
{
date = RTC_GetDate();
time = RTC_GetTime();
alarm = RTC_GetAlarmDateAndTime();
why I am getting this error ?
Build error: too few arguments to function 'RTC_GetAlarmDateAndTime'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi vead
I am pic.programmer at edaboard. I am trying to solve your problem. You have to do like this.
I am waiting for the answer here.
http://www.cypress.com/forum/psoc-4-architecture/how-set-values-time-date-dayofweek-and-status
{code}
RTC_date_time myDateAndTime, myAlarmDateAndTime;
uint32 alarmStatus = 0;
//Set these values. They are uint32 type values.
myDateAndTime.time =
myDateAndTime.date =
myDateAndTime.dayOfWeek =
myDateAndTime.status =
myAlarmDateAndTime.time =
myAlarmDateAndTime.date =
myAlarmDateAndTime.dayOfWeek =
myAlarmDateAndTime.status =
RTC_SetDateAndTime(myDateAndTime.time, myDateAndTime.date);
RTC_SetAlarmDateAndTime(&myAlarmDataAndTime);
RTC_SetAlarmMask(RTC_ALARM_SEC_MASK | RTC_ALARM_MIN_MASK | RTC_ALARM_HOUR_MASK
| RTC_ALARM_DAYOFWEEK_MASK | RTC_ALARM_DAYOFMONTH_MASK | RTC_ALARM_MONTH_MASK | RTC_ALARM_YEAR_MASK);
Read Alarm Status to check if Alarm has a match using
alarmStatus = RTC_GetAlarmStatus();
if(alarmStatus) {
//Current time and date match alarm time and date
RTC_ClearAlarmStatus();
//Turn on an LED
}
{/code}