本人接触AVR单片机不久,参见网上创建ASF项目操作流程,程序编译成功,通过智峰软件设置熔丝并下载成功后,实验板(网购)上Atmega16单片机PC6控制的继电器,无任何现象。不知参数是否设置完整,求各位大神解答!!!
程序如下:
#include <asf.h>
#define RELAY IOPORT_CREATE_PIN(PORTC,6)
int main (void)
{
/* Insert system clock initialization code here (sysclk_init()). */
board_init();
delay_init();
ioport_init();
ioport_set_pin_dir(RELAY,IOPORT_DIR_OUTPUT);
ioport_set_pin_level(RELAY,IOPORT_PIN_LEVEL_LOW);
while(1)
{
ioport_toggle_pin_level(RELAY);
delay_ms(500);
}
/* Insert application code here, after the board has been initialized. */
}
|