When I run the code below in Proteus ( IAR C) found in the web (complete code is folder "THN128 receiver" by A.Yerezeyev), between one timer1 interrupt service and the other I have the message as per subject: Sleep instruction executed when SE bit is not set. Do nothing.
Don't know what it exactly means.
I expected at the end of the main a while(1) endless expecting the interrupt to occur, but it's not the case.
In spite of this it seems there's a CPU sleep at the end of the main, after the printf of the string, that works and waits for timer1 interrupt every 16us.
I don't understand why there's a sleep instruction executed, since I can see no sleep call at all in the code.
Is the closing curly brace enough to tell the compiler to sleep waiting for the interrupt?
Thanks a lot for any kind clarification.
Regards
Code: Select all
/********************************************************************************************
Oregon Scientific v 1.0 decoder routine for THN128 sensors and RLP434A 433.92MHz receiver
(c) by Alexander Yerezeyev 2007-2009
URL: http://alyer.frihost.net
email: wapbox@bk.ru
ICQ: 305-206-239
MCU: ATMEL AVR ATMEGA16 @ 16MHz
********************************************************************************************/
#include "main.h"
#include "io.h"
#define MainTimerStart()\
TCCR1B=(1<<WGM12)|(1<<CS00);\
OCR1A=0x00FF;\
sbi(TIMSK,OCIE1A);
char const __flash _Hello_string[]=\
"\r\n***********************************\r\n\
*** Oregon Scientific THN128 receiver\r\n\
*** v1.00 ATmega16\r\n\
*** (c)2009 by Alexander Yerezeyev\r\n\
*** e-mail: wapbox@bk.ru\r\n\
*** http://alyer.frihost.net\r\n\
*** ICQ: 305206239 \r\n\
************************************ \r\n";
int main( void )
{
sbr (DDRD, PD5); // LED pin as output
_delay_ms(200);
cbr (PORTD, PD5); // LED OFF
#ifdef TRACEMODE
uart_init();
#endif
cli();
MainTimerStart();
sbr (TIMSK, OCIE0); //enable OC T0 interrupts
sbr (MCUCR, ISC11); // Falling edge on INT1 generate an interrupt
cbr (MCUCR, ISC10);
sbr(GICR, INT1); // Enable INT1 processing
GIFR=(1<<INTF1); // Clear INT1 IRQ
sei();
#ifdef TRACEMODE
printf_P(_Hello_string);
#endif
}