Dear guru's,
Hardware used
cpu =mega2560 R3
ide =arduino
pheripheral= w5100 shield
sensors dht22
project details:- Hobby project temperature/humidity logger
I am checking for ethernet clients continuously inside timer1_isr. I have set the timer1 in Overflow capture interrupt mode for 2 sec ovf period. I disable the timer1_isr before processing the client's and then re_enabling the isr using defined macros.
#define enable_timer1 TIMSK1 |= (1 << OCIE1A); TCNT1=0;
#define disable_timer1 TIMSK1 &= ~(1 << OCIE1A); TCNT1=0;
void scan_clients()
{
disabling timer1_interrupt;
checking_ethernet clients request and processing request;
enabling_timer1_interupt;
}
isr_timer1(ovf)
{
scan_clients();
}
loop()
{
i2c_display ();
delay(2000);
}
I need your expert answers on whether we can execute a function inside timer1 16bit by disabling the the timer1 _isr and executing the code and then re-enabling the timer_isr;
Problem is sometimes loop () code just hangs but timer1_isr keeps working