AS小白首次使用AS7创建ASF项目,单片机型号为Atmega16A,实验板是网上买的。在网上参见了很多ASF创建教程,操作步骤是一步一步来的。直接创建的GCC C ASF Board Project,程序编译成功并下载后,实验板PC6控制的继电器无任何现象。求各位高手解答,应如何正确的创建ASF项目?
源代码:
#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. */
}
|