CCS - View Topic - Alarm
CCS - View Topic - Alarm
Alarm
Author Message
Guest Alarm
Posted: Fri Apr 29, 2005 8:34 am
Hello,
i wondered if someone could help me to understand the alarms on DS RTC, like DS1302 or
DS1306.
What i want to do is to put a buzzer on (on the pic) when for example a door sensor (on the PIC
as well) is true for 30 seconds.
How can i count with this alarm using the interrupts pins of the DS ?
Thanks a lot.
Hi. Is this Global again? If yes, then try registering on this forum. It's for free and with your
Joined: 18 Mar 2004
Posts: 1332 name showing we know who we are dealing with. Posting as Guest is not very polite.
Location: The Netherlands
Sorry !
Joined: 01 Feb 2005
Posts: 63
I was not logged on ! Maybe i was disconnected !
Yes it is me =)
I need to have an interrupt on my PIC when the RTC matches with the alarm.
When the SENSOR_PIN is 1, i read the time and then add 1 minute to set the alarm one minute
later. When the alarm is on interrupt on the PIC, is switch on all the leds.
1 от 4 27.2.2007 г. 12:46
CCS :: View topic - Alarm http://ccsinfo.com/forum/viewtopic.php?t=22706&highlight=int0...
one minute ... and to set the alarm once when SENSOR_PIN is 1.
Here is my code :
Code:
#INT_EXT
ext_isr()
{
output_high(LED_1);
output_high(LED_2);
output_high(LED_3);
output_high(LED_4);
output_high(LED_5);
output_high(LED_6);
output_high(LED_7);
output_high(LED_8);
}
void main(void)
{
while(1)
{
if (!input(SENSOR_PIN))
{
rtc_get_time(heure, min, sec); // get the time
enable_interrupts(global);
enable_interrupts(int_ext);
ext_int_edge(L_TO_H);
disable_interrupts(global);
disable_interrupts(int_ext);
}
Any idea ?
Joined: 01 Feb 2005
Posts: 63
Thanks !
2 от 4 27.2.2007 г. 12:46
CCS :: View topic - Alarm http://ccsinfo.com/forum/viewtopic.php?t=22706&highlight=int0...
Thank you.
Last edited by global on Fri May 06, 2005 6:37 am; edited 1 time in total
Hello,
Joined: 01 Feb 2005
Posts: 63
I did this which seems to work :
Code:
min = min + 1;
Last edited by global on Mon May 09, 2005 7:10 am; edited 1 time in total
Hello,
Joined: 01 Feb 2005
Posts: 63
i need to use the DS1306 again, and i thought i found the way to make it work but it seems that
the interrupt generated by the DS1306 is not seen by the PIC. I am sure that it is generated
because the alamr is well configured and the registers are correct when it is generated.
I checked the register that shows if the alarm works on the DS1306, it is fine.
the trouble is i can't make it work properly with the #INT_EXT interruption.
Quote:
1) I guess a sleep() call is missing after you enabled the interrupts?
3 от 4 27.2.2007 г. 12:46
CCS :: View topic - Alarm http://ccsinfo.com/forum/viewtopic.php?t=22706&highlight=int0...
Code:
enable_interrupts(INT_RTCC);
enable_interrupts(INT_TIMER1);
//enable_interrupts(INT_TIMER2);
//enable_interrupts(INT_TIMER3);
enable_interrupts(GLOBAL);
enable_interrupts(INT_EXT); // interruptions alarme
ext_int_edge(L_TO_H);
Code:
#INT_EXT
ext_isr()
{
output_high(LED_RED);
}
Any suggestion ?
Many thanks.
Quote:
Joined: 06 Sep 2003
Posts: 6760 it seems that the interrupt generated by the DS1306 is not seen by the PIC
I checked if it was a hardware problem but nothing ...
You didn't say what interrupt pin you're using on the DS1306.
The \INT0 pin on the DS1306 is open-drain and requires a pull-up
resistor. Also, it's active low.
Hello,
Joined: 01 Feb 2005
Posts: 63
many thanks, you are correct but i already added the pull-up :p
It is the INT0.
I putted ext_int_edge(H_TO_L);
I think it was a hardware problem, i just soldered the PIC pin on B0 and it works !
Thanks again.
Best regards.
Page 1 of 1
4 от 4 27.2.2007 г. 12:46