DELAYbuildinภายในAVRSTUDIO
20/6/2558 SONGCHAI PRAPATRUNGSEE
DELAYbuildinภายในAVRSTUDIO
SOURCE CODE
/*
* AT.c
*
* Created:
19/6/2558 12:06:48
* Author: sc
*/
#include <avr/io.h>//REGISTER OF AVR
#define F_CPU 8000000//DEFINE CLOCK SPEED
#include <util/delay.h>//FOR DELAY
int main(void)
{
DDRA=255;//DDRX
1=OUTPUT,O=INPUT
while(1)//LOOP
FOREVER
{
PORTA=0XF0;
_delay_us(1000);//Microsec
PORTA=0X0F;
_delay_us(1000);//Microsec
PORTA=0XF0;
_delay_ms(1000);//Millisec
PORTA=0X0F;
_delay_ms(1000);//Millisec
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น