Help with writing to registers for 1Hz pwm and timer interrupt

...needs to be protected with a critical section.