| 数据搜索系统,热门电子元器件搜索 |
|
ST9 数据表(PDF) 73 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
ST9 数据表(HTML) 73 Page - STMicroelectronics |
|
73 / 146 page ![]() 73/146 ST9 USER GUIDE /* *********** Configure Watchdog for Periodic Interrupt *************/ void ConfigWDT ( void ) { SelectPage( WDT_PG ) ;/* select Watchdog page */ WDTPR = 0 ;/* 122 us = 366 ticks */ WDTR = 365 ;/* preset is nb ticks-1 (WDTR is the pair WDTLR and WDTHR) */ WDTCR = (WDTm_stsp) ;/* WDT is set to continuous mode, no inputs, no outputs */ /* Interrupt must be connected to intA0 in the EIVR register */ } The initialisation routine for INTA0 follows. In this example application, interrupt A0 is the only "external" interrupt enabled, and it is assigned priority level 2: /* ***********Initialise Interrupt A0 and Current Level **************/ void ConfigInterrupts ( void ) { SelectPage( EXINT_PG ) ; EIVR = (EIm_tlism+(unsigned char)INTA0VECT) ;/* int. A0 is generated on WDT overflow */ EIPLR = 1 ;/* intr A0 (and that of same group) with high priority */ EIMR = EIm_ia0m ;/* intr A0 alone enabled */ CICR = (Im_gcenm+Im_iamm+Im_ienm)+7 ; /* current processing level: minimum ; int. enabled, nested mode */ /* This starts also the MFT */ } 4.3.3 Watchdog Application 1: Generating a PWM This application provides a PWM with a programmable duty cycle. You can use it as an appli- cation exercise for learning to use the programming and debugging tools since it is very simple. The only hardware required to watch the effect of the program is a LED in series with a resistor connected between P4.4 and Vcc (anode towards Vcc). You will find the application in the Companion software in the WDT/appli1 directory. The WDT can only provide a delay after which the output may change its state, and an inter- rupt is triggered. The principle of using the WDT as a rectangular signal generator is to set it to Continuous mode, to load it with a time value, and let it count down until zero. The control register is set so that an interrupt is then generated, and the output pin is updated at the same time. The interrupt service routine will reload with the other value, and preset the WROUT bit to the complement of the current value, so that the opposite state will be transferred to the |
|
链接网址 |
| 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 |