📄 ctc.c~
字号:
/*****************************************************
Chip type : ATmega16
Program type : Application
AVR Core Clock frequency: 4.000000 MHz
Memory model : Small
External RAM size : 0
Data Stack size : 256
*****************************************************/
#include <mega16.h>
#include "delay.h"
// Timer 0 output compare interrupt service routine
interrupt [TIM0_COMP] void timer0_comp_isr(void)
{
// Place your code here
//OCR0=0xaa;
}
// Declare your global variables here
void main(void)
{
// Declare your local variables here
PORTB=0x00;
DDRB=0x0F;
TCCR0=0x1b; //00011000 com01
TCNT0=0x00;
OCR0=0xfd;
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x02;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
PORTB=0x0f;
delay_ms(1000);
delay_ms(1000);
// Global enable interrupts
PORTB=0x0f;
delay_ms(1000);
delay_ms(1000);delay_ms(1000);delay_ms(1000);
delay_ms(1000);delay_ms(1000);
delay_ms(1000);delay_ms(1000);
delay_ms(1000); #asm("sei")
while (1)
{
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -