The clock alarm wakes the 328
Yes.
the 328 has to cancel it's interrupt
This is done without any software intervention.
then write to the clock to clear the alarm flag
Yes.
then read the external temperature sensor and store it to memory
Or whatever needs to be done.
then reset the clock alarm and then reset it's own interrupt again,
No. The alarm is already set. Unless you change it, the alarm will fire again in one hour (or whatever interval the alarm is set for). Once you set the alarm and attach the interrupt the only thing you have to do with respect to the alarm is clear the alarm flag when the interrupt wakes up the processor from sleep. You also do not do anything about detaching/attaching the interrupt once it has been set.
then go back to sleep
Yes.
It's a shame the clock alarm duration can't be set when the alarm time is set. It would be nice to just get a 100 millisecond pulse from the clock to initiate the interrupt of the 328.
I don't understand what you mean.
The basic structure of your code would be:
void clock_interrupt(void)
{
}
void setup(void)
{
1. Initialize the SPI library
2. Initialize the temperature sensor
3. Initialize the RTC alarm.
4. attach the clock_interrupt function to the alarm (presumably Arduino pin 2)
}
void loop(void)
{
1. go to sleep
2. reset the alarm flag
3. read the temperature and store it
}
Note that the clock interrupt function doesn't do anything. Once it returns from the interrupt the processor will be woken up and code execution will resume after the sleep.
After step 3 of the loop() is done you just return from the function. This will almost immediately bring you back into the loop function again where you will promptly go back to sleep until the clock alarm causes the next interrupt.
Pete