Hi guys,

Got my sample almost working ! Configuration is a little bit different from
18f26j11 but it seems to work.


I don't use RTCC pin, but would like to control a LED on another pin, when
alarm is active. Unfortunately I can't find any interrupt strictly related
to alarm events. RTCC pin can be driven with alarm interrupts, but there's
no actual register to read from.

Do I miss something ? I surely do... Currently, in ISR, I read time and
check if equals to alarm time. If so, alarm is active:

--
rtc_init()
rtc_calibrate(0)

-- let's say we're April 23rd 2011, it's 10:56:12 o'clock.
-- Alarm is set at 10:56:17
var  byte*3  datenow = 0x230411
var  byte*3  timenow = 0x125610
var  byte*3  alarmtime = 0x175610

rtc_set_yymmdd_bcd(datenow)
rtc_set_hhmmss_bcd(timenow)
rtc_set_alarm_hhmmss_bcd(alarmtime)

rtc_set_alarm(true)
rtc_set_alarm_period(RTC_ALARM_PERIOD_SECOND)
rtc_set_alarm_repeat(10)

-- isr

var bit alarm_is_ringing = false
procedure school_is_over() is
   pragma interrupt
   if ! PIR3_RTCCIF then
      return
   end if
   if !alarm_is_ringing then
      timenow   = rtc_get_hhmmss_bcd()
      if timenow == alarmtime then
         alarm_is_ringing = true
      end if
   end if
   if alarm_is_ringing != 10 then
      if ALRMRPT then
         onboard_led = !onboard_led
      end if
   end if
   PIR3_RTCCIF = false -- clear flag
end procedure


Results: LED is blinking 5 times: on, off, on, off, on. Every 1s. But it
should blink 10 times, as repeat 10 and period = 1s.

I would prefer read a register to know if alarm is currently ringing...


Cheers,
Seb


2011/4/5 Rob Hamerling <[email protected]>

>
> Hi Seb, Joep,
>
>
> On 2011/04/05 19:42, Joep Suijs wrote:
>
>
>>     - show_byte_bcd
>>>
>> I guess we call this print_byte_hex() ;)
>>
>
> Indeed, it is almost the same as the comment in the sample says.
>
> I've resumed working on my rtc alarm clock, made some corrections and
> renamed the sample program to 18f26j11-rtcc-hw_kbd_lcd.jal.
>
>
> Regards, Rob.
>
> --
> R. Hamerling, Netherlands --- http://www.robh.nl
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to