| công cụ tìm kiếm bảng dữ liệu linh kiện điện tử |
|
AN3404 bảng dữ liệu(PDF) 17 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN3404 bảng dữ liệu(HTML) 17 Page - STMicroelectronics |
|
17 / 30 page ![]() AN3404 General power management tips Doc ID 018847 Rev 3 17/30 5.3 Dynamic control of pull-up resistor Many applications have buttons which are used as a user interface. These buttons are connected to I/Os that are connected to VSS once they are pressed. An internal pull-up is used in order to have a defined logic level on these I/Os when the button is off (not pressed). Once the button is pressed, the I/O is grounded and it generates an additional current of ~ 40 – 70 µA, drawn from the power supply. This current is negligible if the application is in Run mode, but becomes very important for applications which run mainly in low power modes. For such low-power applications, the pull-up can be dynamically controlled. Once a button is pressed, the related service routine is executed. This routine disables the pull-up and the interrupt, in order to save consumption while the button is being pressed. As the application has to check the button status regularly, the pull-up is enabled again before any checks are made. If the button is continuously pressed, the process is repeated. Once the button release is detected, the pull-up remains on. For this task, an I/O can be left floating for a short time frame, given by a check period, generating an extra consumption in the range of ~10 µA. Therefore, the total current consumption for a button-press operation is lower than without such dynamic control. 5.4 Waiting loops/delays In some cases, the application has to wait for an input from the user, communication peripheral, or another external unit. If there is no useful code to execute while waiting for an input, it is recommended to avoid using either a typical delay loop or a polling loop. ● Typical delay loop: (delay = 0; delay < 0xFFFF; delay++) _asm ("nop"); ● Polling loop: SPI_DR = data; // start communication while (!( SPI_SR & SPI_SR_TXE)); // wait for TXE bit set A Wait mode woken up by an interrupt on the SPI transmitter empty (SPI_SR_TXE flag) is advised by the following sequence: ● Enable TXE interrupt: SPI_ICR |= SPI_TXIE; // enable interrupt for Tx empty An event is then generated after each byte is sent. The next data can be loaded in the Tx buffer as follows: SPI_DR = data; // start communication _asm ("wfi"); //or wfi() if you include STM8TL5x.h file in your project The sequence described above uses WFI mode to wait for Tx buffer empty. A delay loop can be replaced by a Wait mode woken up by a programmed timer interrupt or better an Active- halt with AWU if no other peripheral is running. This can also be used for other communication lines. For external sources (like interrupt from an I/O port), Halt mode can also be considered. |
|
Link URL |
| Cho đến nay ALLDATASHEET có giúp ích cho doanh nghiệp của bạn hay không? [ DONATE ] |
Alldatasheet là | Quảng cáo | Liên lạc với chúng tôi | Chính sách bảo mật | Liên kết đến bảng dữ liệu | Trao đổi link | Tìm kiếm theo nhà sản xuất All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |