这个闪灯用的延时同以前的不一样,是用Studio自身的延时,十分方便,这一点上,51就不如AVR啦!
/*
* GccApplication8.c
*
* Created: 2014-10-2 17:03:12
* Author: Administrator
*/
#define F_CPU 8000000UL
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRC = 0xFF;
while(1)
{
//TODO:: Please write your application code
PORTC ^= _BV(PC0);
_delay_ms(120);
}
}
|