用ICC AVR出现的这个个错误,如何修改啊,我新入门
//ICC-AVRapplicationbuilder:2012-4-1712:19:25//Target:M16//Crystal:1.0000Mhz#include<...
//ICC-AVR application builder : 2012-4-17 12:19:25
// 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;
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
}
}
//call this routine to initialize all peripherals
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; //1脚为高,0脚为低,0脚灯亮
Delay(); //延时
PORTA = 0x01; //0脚为高,1脚为低,1脚灯亮
Delay(); //延时
}
} 展开
// 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;
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
}
}
//call this routine to initialize all peripherals
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; //1脚为高,0脚为低,0脚灯亮
Delay(); //延时
PORTA = 0x01; //0脚为高,1脚为低,1脚灯亮
Delay(); //延时
}
} 展开
展开全部
//ICC-AVR application builder : 2012-4-17 12:19:25
// 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;
}
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
}
//call this routine to initialize all peripherals
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; //1脚为高,0脚为低,0脚灯亮
Delay(); //延时
PORTA = 0x01; //0脚为高,1脚为低,1脚灯亮
Delay(); //延时
}
}
可以了,你编译一下吧,你大括号的问题
// 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;
}
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
}
//call this routine to initialize all peripherals
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; //1脚为高,0脚为低,0脚灯亮
Delay(); //延时
PORTA = 0x01; //0脚为高,1脚为低,1脚灯亮
Delay(); //延时
}
}
可以了,你编译一下吧,你大括号的问题
追问
非常感谢
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询