Hi Seb,

On 2011/04/10 10:05, Sebastien Lelong wrote:

Indeed, works great, thanks ! I've finally seen the light too ! The
"repear" feature is somewhat tricky, because its behavior is somewhat
different from usual alarm clocks...

In the new library I try to mimic the functionality of 'traditional' alarm clocks. I've committed it for you, but need some more tests to see if everything works as intended (and is intuitive).

Figure 17-5 page 253 from
PIC18F47J53 datasheet is the important one:
   - when period is 10 seconds, you can set an alarm with seconds (in
your sample, 5 seconds after RTC is on
   - when period is 1 second, you can't specify any alarm time, it'll
just raise interrupts every second.

I'll see if I can handle the limitations.

Running an alarm only once is also tricky, and can be done by setting a
period high enough to include the full alarm time parameters (hours,
minutes & seconds), otherwise ISR will be raised each half second
(default).

OK! I'll keep that in mind.

Then:

   - no repeat setting (0), in ISR, check if ALRMEN is off (it's cleared
when reaching last repeat, that is, none in this case
   - setup 1 repeat, in ISR check if ALRMEN is on. When it's off the
second time it runs ISR (that is, the actual repeat), it's get ignored.


Tricky again: in your setup, when repeat = 5, ISR is actually called six
times, the last ALRMEN bit is cleared.

Shouldn't 'repeat' be read as 'number of times after the first time'? To me that seems normal.

Attached is your sample slightly modified to run alarm only once, at
specified time.

The board I have was meant for a 18f26j11. I replaced the chip with a 18f27j53 (for exchange with you), but it doesn't run. I have not found why...

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