Different from your comment, the time you set initially is the very same time you set for the alarm. Install the 5 seconds difference and it might work.
Bob
I have been looking at your program and I have found some issues. I had to add a software UART to check if your program was working. I 1) found the clock is not running. That is why your Alarm is not going off. 2) resistor is 560 ohms not 460 ohms. 3) Led was marked as a Diode not a LED. 3) You have the LCD on the wrong port. Port 2 is for analog per the PSOC Specs. It should be on Port 0 or Port 1. 4) You have not set the LCD_Start(); in your program for the LCD. This is required for the LCD to be setup correctly. 5) Set alarm mask is not correct. You should remove the seconds from the alarm by using this command RTC_SetAlarmMask((unit32)~RTC_ALARM_SEC_MASK); Yours instruction is not doing that. 6) You are missing the CySysTickStart(); from your program.
7) Reboot your computer to see if that fixes your programming issue.
You never clear the alarm flag when the alarm clears. Also you toggle the
LED rather than set it when flag is 1, clear it when flag is 0.
Regards, Dana.
when I put below code it works , when alarm is on , LED turn on for 5000 seconds and then turn off
void AlarmIsrHandler(void)
{
alarmFlag = 1u;
Alarm_LED_Write(1);
CyDelay (5000);
alarmFlag = 0u;
Alarm_LED_Write(0);
/* Clear interrupts state */
RTC_ClearAlarmStatus();
}
Now first alarm become true , how to set multiple alarm , you told me I need to create flag
void AlarmIsrHandler(void)
{
alarmFlag1 = 1u;
Alarm_LED_Write(1);
CyDelay (5000);
alarmFlag1 = 0u;
Alarm_LED_Write(0);
/* Clear interrupts state */
RTC_ClearAlarmStatus();
}
{
alarmFlag2 = 1u;
Alarm_LED_Write(1);
CyDelay (5000);
alarmFlag2 = 0u;
Alarm_LED_Write(0);
/* Clear interrupts state */
RTC_ClearAlarmStatus();
}
You should not use large delays like that, wastes CPU time, accomplishes nothing.
CPU just burns power, does nothing else like monitor other activity, etc.....
Use a flag to control the alarm LED. Set when its on from alarm ISR, clear when it is alarm no
longer valid.
Regards, Dana.
I am setting large delay to turn ON/OFF device for week , or months
your reply is same as your previous answer
suppose I want to set two alarms
so that I used two flags
alarmflag1
alarmflag2
void AlarmIsrHandler(void)
{
alarmFlag1 = 1u;
Alarm_LED_Write(1);
CyDelay (5000);
alarmFlag1 = 0u;
Alarm_LED_Write(0);
/* Clear interrupts state */
RTC_ClearAlarmStatus();
}
{
alarmFlag2 = 1u;
Alarm_LED_Write(1);
CyDelay (5000);
alarmFlag2 = 0u;
Alarm_LED_Write(0);
/* Clear interrupts state */
RTC_ClearAlarmStatus();
}
ok I will try
also I have other issue actually I have used one flag in my program In which I am controlling LED
example :
void AlarmIsrHandler(void)
{
alarmFlag = 1u;
Alarm_LED_Write(1);
CyDelay (5000);
alarmFlag = 0u;
Alarm_LED_Write(0);
/* Clear interrupts state */
RTC_ClearAlarmStatus();
}
how to use two flags for two alarms ?
flag1 ( first alarm)
flag2 ( second alarm )
how to execute alarm one by one ?
Vead your clock is running extremely fast. About 8 minutes for each real minute. I check this with a stop watch and was not able to get a good start time but my readings are at least 8 or more minutes too fast. I have to ask why you have not used the programs I have sent to you in the past? They are running at the correct time. I'll be modifying a working program and see it to you.
I saw that Program , I don't have Miniprog, also I don't want to use ds1307 because RTC software component can work. so why we use ds1307. I don't care If some time loss occur. yes the clock is running very fast. I want to ask you, there is any way sothat we can get accurate time
I am not talking about the DS1307 clock program. This is a PSOC program that has a good clock source from the PSOC chip that is okay but not as good as a Crystal clock source. I should have the program done by later today. Do you want the LCD device on the program? if so I'll add that to the program an put it on the correct port.
Hello bobgoar
I want to see your program. yes I want to show resulat on LCD . If possible please set alarm for two different date. I am just waiting to see your program for accurate time
Using onboard OpAmp build a 32 Khz oscillator using external xtal.
http://www.edn.com/design/analog/4396957/Crystal-oscillator-circuit-is-ultralow-power
Regards, Dana.
Scratch the prior post, I do not think there is any way to route the 32 Khz from
an external pin to the RTC. Although datasheet states update of RTC can be mapped
to a number of different interrupts. Possibly feed the external osc to a pin with an
interrupt tied to it ? And mapped to the RTC ? Not sure if that would work. Possibly
use the pin interrupt to register write and initiate in the ICU an interrupt the RTC
can use.....
The other way is to use a method during production test to cal the chips LO.
Whats the accuracy target you have ?
Regards, Dana.
VEAD: Here is a way to add a crystal to your CY8CKIT_049-42XX PSOC 4 Prototyping kit. http://www.cypress.com/file/140221/download and this document http://www.cypress.com/knowledge-base-article/implementing-32-khz-eco-interface-psoc-4100psoc-4200-k.... This will make your clock very accurate. I am working on the program still I had a computer failure and changed to another machine.
The crystal you use has recommended C loading you should follow. Also keep
in mind pin C factors into the C you choose. Additionally the series equiv of
the two Cs used to load should equal the recommended loading. In other words
if xtal wants a 10 pf load, use two 20 pf caps. Essentially you have a tank circuit
consisting of the two caps in series in parallel with the xtal operating in its inductive
mode on its phase/Z curve.
Regards, Dana.
you mean I have to use psoc 4 software component, two capacitors and one 32 khz oscillator.I have added two capacitors and one 32 khz oscillator on Top design. but how to route all components ?
Something like this, attached. The passives are not actual chip routes, just
a way of documenting external components. You would add the 2 caps, and
the R bias network, and the R used to limit xtal "activity", Pdiss.
Note the pic shows Hysteresis enabled, I would disable that in
Comparator properties.
Regards, Dana.
Vead I was thinking that you might want to upgrade to a CY8CKit-044 PSOC 4M Pioneer kit it has a 32.768kHz crystal already installed. Also the CY8CKit-042 Ble Kit also has a 32.768 kHz crystal installed. Or you could also consider a CY8CKit -049 PSOC 5LP Prototyping kit. The issue with the PSOC 5 LP is that it uses and different RTC component and it seems a little harder to use. The other kits would work out of the box. I do not know if these are within your budget however. The clock circuit for the CY8CKIT-049 PSOC 4 PROTOTYPING KIT is very easy to setup you just need a few resistors and two caps and the WCO crystal.
Hello Mr. bobgoar
If I am not wrong , I have to add the your crystal program in my RTC program to see accurate time. may be it looses about 5-8 minutes in a day , its ok, when I open your project there is error ''Unable to find component "cy_boot_v5_10". how to remove that error
What version of Psoc Creator are you using? This was made on Psoc Creator 3.2. SP1 Sorry for the duplicate post. My Phone caused this.
I am using PSoCCreatorSetup_3.2_es10-4_4-2-15
when I don't use bootloadable component I saw three error , if I use botloadable component I saw two error
common error is ''Unable to find component "cy_boot_v5_10".
also I just want to confirm that if I add your clock program in my RTC program , can we get the accurate time ?
Just using the comparator interrupting at a 32 Khz rate maybe not best method,
if resources permit divide 32Khz down to 1 pps or .1 with a timer and use an
interrupt on its Tc pin to update the RTC. That leaves more MIPS for other tasks.
Although disadvantage is cannot be in sleep, timer not running, in that case the
comparator in sleep can generate an interrupt, but 32Khz rate obviates the whole
idea of sleep.
Regards, Dana.
VEAD: Dana is right about using the crystal using the PSOC 4 comparator hardware will not work in the sleep mode and you also have too consider what to do when your PSOC 4 is powered down the RTC clock will stop.
It was the Timer I felt would not be operating, but I correct myself. In sleep
it also will run as well as the comparator. See attached table.
http://www.cypress.com/documentation/application-notes/an86233-psoc-4-low-power-modes-and-power-redu... AN86233 - PSoC® 4 Low-Power Modes and Power Reduction Techniques
Regards, Dana.
Hello
I don't have much knowledge about psoc kits ,. I saw your project , there are crystal , comparator, capacitor and registers , I tried to understand , when I open that project It show the error
sorry but I don't understand what's happening. I know we are setting clock, exactly what we need ?
Vead I tried the program from the Cypress website that I downloaded to you for the Crystal and it worked fine once I Put the correct >hex and .elf for the dependencies for the bootloadable component and it compiled without errors with one warning P1(4) not used in the design. So the program would work if you had the parts. I think it would be best for you to get a board with the crystal already installed in the design such as a CY8CKIT-044. I have been thinking about the two alarms and the program will not let you define 2 alarms with the same name a #define Alarm_hour (0X03u). So I think the 2nd alarm should be defined in the void AlarmISRHandler(void) function as you never return to the Main() part of the program after the first run. So I think the New alarm should be NAlarm_HOUR (0X04u) and so on. I tried to redefine the Alarm_hour but the program would not allow it. That is why the name has to be changed. Also some type of loop needs to be install in the ALarmISRHandler function to prevent the reassignment of the Alarm names. By the way I have been running the CY8CKIT-049_42XX using the system tick as a clock and it has been keeping pretty good time it has not lost or gained more that 2 minutes in 3 days. That may work for your needs. I do not know how accurate your design needs to be.
If 2-4 minutes lost in one day its good. . Please Can you upload your project so that I can see result
There is a PSOC Creator 101 series set of videos you can train on,
look at the older ones first.
http://www.cypress.com/video-library/PSoC-Software
Regards, Dana.
Vead I am using PSoC Creator 3.2 SP1 (3.2.0.6175) so it looks like you are behind my version. That explains the issue you had with the cY boot.