| 数据搜索系统,热门电子元器件搜索 |
|
AN3147 数据表(PDF) 21 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN3147 数据表(HTML) 21 Page - STMicroelectronics |
|
21 / 25 page ![]() DocID17035 Rev 3 21/25 AN3147 Power management tips 24 5.3 Dynamic control of pull-up resistor Many applications have buttons which are used as a user interface. Those buttons are connected to I/Os that are connected to VSS once the buttons 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. 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 mainly running in low power modes. For this type of applications, you can control the pull-up dynamically. 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 pressed. As the application has to check the button status regularly, this pull-up is enabled again before this check. If the button is still pressed, this process is repeated. Once a 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 this dynamic control. 5.4 Waiting loops / delays In some cases, the application has to wait for an input from the user, slow peripheral (ADC), or another external unit. If there is no useful code to execute in the meantime, instead of using: a typical delay loop: (delay = 0; delay < 0xFFFF; delay++) _asm ("nop"); or a polling loop like: ADC_CR1 I= ADC_START; // start conversion while (!( ADC_SR & ADC_SR_EOC)); // wait for EOC bit set it is recommended to use a more advanced solution, using a Wait for event mode: 1. Configure the ADC as a source of event 2. Enable an event by allowing the related interrupt: WFE_CR2 I= ADC_COMP_EV; // enable ADC as a source of event ADC_CR1 = ADC_EOCIE; // enable interrupt for end of conversion An event is then generated after each conversion. The conversion starts as follows: ADC_CR1 = ADC_START; // start conversion _asm ("wfe"); The sequence described above uses WFE mode to wait for an end of conversion. This can also be used for other sources like communication lines, etc. In case of external sources (like interrupt from an I/O port), you can also consider using Halt mode. |
|
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 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 |