#define f_Xtal 16000000

#define Delay_us( usecs ) __delay_cycles( ( f_Xtal / 1000000 ) * ( usecs ) )


void Delay_ms( unsigned char millisecs )

{

while( millisecs-- )

Delay_us( 1000 );

}


void Delay_s( unsigned char secs )

{

while( secs-- )

__delay_cycles( f_Xtal );

}


void Delay_mins( unsigned char minutes )

{

while( minutes-- )

__delay_cycles( 60 * f_Xtal );

}

'Mechanical Engineering > AVR' 카테고리의 다른 글

UART0 Setup  (0) 2013.12.10
CodeVision 초기설정  (0) 2013.11.30
SPI 용어 정리  (0) 2013.06.26
IAR 초기설정  (0) 2013.05.06
IAR EWAVR interrupt vectors from iom128.h  (0) 2013.04.05
Posted by Jay♬
,