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

📄 main.c

📁 //ICC-AVR application builder : 2008-11-9 18:51:09 // Target : M16 // Crystal: 1.0000Mhz
💻 C
字号:
//ICC-AVR application builder : 2008-11-9 18:51:09
// Target : M16
// Crystal: 1.0000Mhz

#include <iom16v.h>
#include <macros.h>

void port_init(void)
{
 PORTA = 0x03;
 DDRA  = 0x03;
 PORTB = 0x00;
 DDRB  = 0x00;
 PORTC = 0x00; //m103 output only
 DDRC  = 0x00;
 PORTD = 0x00;
 DDRD  = 0x00;
}

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

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

void delay(void)
{
 unsigned char i,j;
 for(i = 200; i > 0; i --)
 	   for(j = 200; j > 0; j --);
}

void main(void)
{
 init_devices();
 while(1)
 {
  PORTA = 0x02;
  delay();
  PORTA = 0x01;
  delay();
 }
}


⌨️ 快捷键说明

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