⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 time.h

📁 万能遥控器解码
💻 H
字号:
//ICC-AVR application builder : 2008-8-4 14:22:59
// Target : M8515
// Crystal: 4.0000Mhz

void port_init(void)
{
 PORTA = 0x00;
 DDRA  = 0x00;
 PORTB = 0x00;
 DDRB  = 0x00;
 PORTC = 0x00;
 DDRC  = 0x00;
 PORTD = 0x00;
 DDRD  = 0x00; 
 PORTE = 0x00;
 DDRE  = 0x00; 
}

//TIMER0 initialize - prescale:Stop
// WGM: Normal
// desired value: 100uSec
// actual value: Out of range
void timer0_init(void)
{
 TCCR0 = 0x00; //stop timer
 TCNT0 = 0x00 /*INVALID SETTING*/; //set count value
 OCR0  = 0x00 /*INVALID SETTING*/;
 TCCR0 = 0x00; //start timer
}

#pragma interrupt_handler timer0_ovf_isr:iv_TIM0_OVF
void timer0_ovf_isr(void)
{
 TCNT0 = 0x00 /*INVALID SETTING*/; //reload counter value
}

//call this routine to initialize all peripherals
void init_devices(void)
{
 //stop errant interrupts until set up
 CLI(); //disable all interrupts
 port_init();
 timer0_init();

 MCUCR = 0x00;
 EMCUCR = 0x00;
 GICR = 0x00;
 TIMSK = 0x82;
 SEI(); //re-enable interrupts
 //all peripherals are now initialized
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -