Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
CodeVision AVR 1.25.7, user manual.pdf
Скачиваний:
236
Добавлен:
12.08.2013
Размер:
1.22 Mб
Скачать

CodeVisionAVR

void extended_standby(void)

this function puts the AVR chip in the extended standby mode.

Prior to using this function, the sleep_enable function must be invoked to allow entering the low power consumption modes.

This mode is similar to the powersave mode with the exception that the external clock oscillator keeps on running.

Consult the Atmel Data Sheet for the particular chip that you use, in order to see if the standby mode is available for it.

4.17 Delay Functions

These functions are intended for generating delays in C programs.

The prototypes for these functions are placed in the file delay.h, located in the ..\INC subdirectory. This file must be #include -ed before using the functions.

Before calling the functions the interrupts must be disabled, otherwise the delays will be much longer then expected.

Also it is very important to specify the correct AVR chip clock frequency in the Project|Configure|C Compiler|Code Generation menu.

The functions are:

void delay_us(unsigned int n)

generates a delay of n µseconds. n must be a constant expression.

void delay_ms(unsigned int n)

generates a delay of n milliseconds.

This function automatically resets the wtachdog timer every 1ms by generating the wdr instruction.

Example:

void main(void) {

/* disable interrupts */ #asm("cli")

/* 100µs delay */ delay_us(100);

/* .............

*/

/* 10ms delay */ delay_ms(10);

/* enable interrupts */ #asm("sei")

/* .............

*/

}

 

© 1998-2007 HP InfoTech S.R.L.

Page 176