- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
Define current time and date
Define first alarm time and date
Define second alarm time and date
Define alarm flag1
Define alarm flag2
If alarmFlag1 is set alarmFlag1 = 1u;
and If first alarm time ,date match with current time,date
Then perform following task
Alarm_LED_Write(1);
CyDelay (100);
alarmFlag1 = 0u;
Alarm_LED_Write(0);
alarmFlag2 = 1u;
If second alarm time ,date match with current time,date
Then perform following task
Alarm_LED_Write(1);
CyDelay (5000);
alarmFlag2 = 0u;
Alarm_LED_Write(0);
how to execute two alarm in different flags ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As I understand RTC there is only one alarm at a time. So you will have to install the next alarm in sequence when the first has finished.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
that's the problem,I did cypress forum search but not getting much information I don't understand how to set next alarm ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Set the next alarm just like you did setting the first. Set it when the first Alarm finished.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not getting starting point , I don't understand what should be after ALarmISRHandler function
1. where to define next Alarm time and date , before or after the ALarmISRHandler function ?
2. where to declare Alarm structure, before or after the ALarmISRHandler function ?
3.I Think I don't need to start LCD , RTC after the ALarmISRHandler function, because the already ON ?
4. I think I have to set mask again after ALarmISRHandler function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. where to define next Alarm time and date , before or after the ALarmISRHandler function ?
Set a flag in ISR that indicates a new alarm is needed, service outside ISR, setup the
new alarm, and reset the flag.
2. where to declare Alarm structure, before or after the ALarmISRHandler function ?
Describe it in main() as a basic part of startup for the system.
3.I Think I don't need to start LCD , RTC after the ALarmISRHandler function, because the already ON ?
Correct.
4. I think I have to set mask again after ALarmISRHandler function
If the alarm properties change yes, like next alarm on just year vs prior alarm on year, month, hours.....
Regards, Dana.
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
when I put following code I am getting some error
volatile uint8 Alarm1flag = Alarm1serviced = Alarm2flag =Alarm2serviced = 0;
/* Interrupt prototypes */
CY_ISR_PROTO(AlarmIsrHandler);
CY_ISR (AlarmIsrHandler);
{
If ( ( Alarm1flag == 0 ) && (Alarm2flag == 0 ) ) { // Only set Alarm1flag if both it and Alarm2flag clear
Alarm1flag == 1;
return;
}
If ( ( Alarm1flag == 1 ) && (Alarm2flag == 0 ) ) { // Only set Alarm2flag if Alarm1flag has been set
Alarm2flag == 1;
return;
}
}
int main()
{
line 63 volatile uint8 Alarm1flag = Alarm1serviced = Alarm2flag =Alarm2serviced = 0;
error undeclared Alarm1serviced
error undeclared Alarm2flag
error undeclared Alarm2serviced
line 74 {
error expected identifier '('
how to remove errors
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Vead I am reporting to you that after 1 week the sys tick of the PSOC 4 without a crystal has lost about 5 minutes. Also I thought I told you that it is not a good ideal to use Port 2 of the PSOC 4 for digital signals as these pins are for Analog functions. I have moved the LCD to Port 0. Also for testing purposes you should have the time and date set to current time. Everytime I get one of your programs it is set to 3/22/2016. Why are you setting the date and year in 2016? The Alarm will trigger but you should be setting it to current time just to make it easier to debug.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello bobgoar
I was waiting for your reply I just wanted to see result. yes you told me Port 2 of the PSOC 4 for digital signals as these pins are for Analog functions.
Why are you setting the date and year in 2016?
that was just example. next Time I will set correct time and date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure why this is not working, declare each one on a separate line.
line 63 volatile uint8 Alarm1flag = Alarm1serviced = Alarm2flag = Alarm2serviced = 0;
Note my code is for you to work around, to check by drawing a flow chart that the
logic is right. It was just for example.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
VEAD: I am working on your new file. Your time is still running at high speed. Also you should leave the UART in the program it makes it easier to debug and also you do not need the LCD. So I have installed the UART and have changed the ALARM_LED drive and that is working however the Alarm is working but only on the first alarm. I'll be checking the code to see what needs to be done. The issue with this program is in the while loop. The program is in that loop at all times and does not return to the main section at all. That means the Alarm ISR handler needs to be set in the AlarmISrHandler and the new alarm time needs to be set in that function also. The current program compiles. I do not know what you did to the program to make it run so fast.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Mr. Bobgoar
thank you for helping me , thank you very much bobgoar and dana for your time
actually I want to set the many alarm for device. when alarm is happen the device should be On and when alarm is off device should be OFF
I looked Project example in Psoc creator , Then I tried to modified , also I don't know why my clock is running very fast. also I am trying to find out reason , but first I am trying to execute second alarm
I am using LCD to see the current time and date. so that some one can know, on which time and date, alarm is happening , that's why I am using LCD ,
- 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
Vead : I have fixed the fast time issue and I am now ready to try to fix the multi-alarms.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
that's very good news Mr. bobgoar. can you please tell me what was wrong with my code