代码:
/*******************************************************
This program was created by the
CodeWizardAVR V3.12 Advanced
Automatic Program Generator
?Copyright 1998-2014 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com
Project :
Version :
Date : 2024/6/7
Author :
Company :
Comments:
Chip type : ATmega16
Program type : Application
AVR Core Clock frequency: 8.000000 MHz
Memory model : Small
External RAM size : 0
Data Stack size : 256
*******************************************************/
#include <mega16.h>
// Declare your global variables here
interrupt [TIM0_COMP] void timer0_comp_isr(void)
{
PORTA.0=~PORTA.0;
}
void main(void)
{
// Declare your local variables here
PORTA=1;
DDRA=1;
PORTB=1;
DDRB=0;
TCCR0=0X0f;
TCNT0=0X00;
OCR0=0x7c;
TIMSK=0X02;
#asm("sei");
while (1)
{
// Place your code here
}
}
仿真效果图:
文章评论(0条评论)
登录后参与讨论