# Timer1 interrupt priority?

**URL:** <https://forum.arduino.cc/t/timer1-interrupt-priority/387786>\
**Category:** Programming\
**Created:** [May 24, 2016, 12:42am UTC](https://forum.arduino.cc/t/timer1-interrupt-priority/387786 "2016-05-24T00:42:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmaurin](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@jmaurin](https://forum.arduino.cc/u/jmaurin)\
**Post date:** [May 24, 2016, 12:42am UTC](https://forum.arduino.cc/t/timer1-interrupt-priority/387786/1 "2016-05-24T00:42:24Z")

</div>

Hi!

I'm trying to solve a little problem, but I'm lost. U'm building an home alarm system which includes a dimming system for home lights, all in same Arduino.  
The problem is that I can't make my RF decoder work with my dimming functions.  
My dimming function is working fine. Since here we have 127v at 60Hz, making calculations give me 8333uS for a half wave fom grid. In this time, I must switch my TRIAC on or off to make my lamp dimming. I've divided this time (8333uS) by 128, so I have 128 steps. Each 'step' takes 65uS, so I've setup Timer1 to interrupt on this time and in this function I have my calculations to turn lamp on or off (withou using any 'delay' function!) and this is working perfeclty!  
The problem is that when I try to use my RF decoding routine (not written by me), the RF doesn't work....simple doesn't recognize anything from my controls!  
My guess is that during some function from RF decoding, my arduino is stopping this routing to serve timer1 interrupt. Why I think that? Because I've changed my interupt routine to 180uS and RF started working again.....but this way, my Dimmer has only 46 steps and this make my lights blink a little and we can see these blinks.  
My question is: is there any way to make both os these codes to work togheter?  
In this example, I'm using '108' for variable 'freStep', but should be ate least '65'.

This is what I have for now: [http://www.jonis.com.br/central.zip](http://www.jonis.com.br/central.zip)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 5, 2021, 9:54pm UTC](https://forum.arduino.cc/t/timer1-interrupt-priority/387786/2 "2021-05-05T21:54:41Z")

</div>

Closed on May 5, 2021, 9:54pm UTC


