| 数据搜索系统,热门电子元器件搜索 |
|
HT82B40A 数据表(PDF) 21 Page - Holtek Semiconductor Inc |
|
|
|||||||||||||||||||||||||||||
HT82B40A 数据表(HTML) 21 Page - Holtek Semiconductor Inc |
|
21 / 54 page ![]() HT82B40R/HT82B40A Rev. 1.70 21 November 5, 2014 org 04h ; USB interrupt vector reti org 08h ; Timer/Event Counter interrupt vector jmp tmr0int ; jump here when Timer0 overflows : org 20h ; main program ;internal Timer/Event Counter 0 interrupt routine Tmr0int: : ; Timer/Event Counter 0 main program placed here : reti : : begin: ;setup Timer registers mov a,09bh ; setup Timer preload value mov tmr0,a; mov a,080h ; setup Timer control register mov tmr0c,a ; timer mode ; setup interrupt register mov a,005h ; enable master interrupt and timer interrupt mov intc,a set tmr0c.4 ; start Timer/Event Counter - note mode bits must be previously setup Interrupts Interrupts are an important part of any microcontroller system. When an internal function such as a Timer/Event Counter overflow or a USB interrupt occur, their corre- sponding interrupt will enforce a temporary suspension of the main program allowing the microcontroller to direct attention to their respective needs. while the internal in- terrupts are controlled by the Timer/Event Counter over- flow, USB interrupt or reception. Interrupt Register Overall interrupt control, which means interrupt enabling and request flag setting, is controlled by an interrupt control register. By controlling the appropriate enable bits in this register each individual interrupt can be en- abled or disabled. Also when an interrupt occurs, the corresponding request flag will be set by the microcontroller. The global enable flag if cleared to zero will disable all interrupts. Interrupt Operation When a USB interrupt occurs or one of the Timer/Event Counters overflow, if their appropriate interrupt enable bit is set, the Program Counter, which stores the ad- dress of the next instruction to be executed, will be transferred onto the stack. The Program Counter will then be loaded with a new address which will be the value of the corresponding interrupt vector. The microcontroller will then fetch its next instruction from this interrupt vector. The instruction at this vector will usually be a JMP statement which will jump to another section of program which is known as the interrupt ser- vice routine. Here is located the code to control the ap- propriate interrupt. The interrupt service routine must be terminated with a RETI statement, which retrieves the original Program Counter address from the stack and al- lows the microcontroller to continue with normal execu- tion at the point where the interrupt occurred. The various interrupt enable bits, together with their as- sociated request flags, are shown in the accompanying diagram with their order of priority. Once an interrupt subroutine is serviced, all the other in- terrupts will be blocked, as the EMI bit will be cleared au- tomatically. This will prevent any further interrupt nesting from occurring. However, if other interrupt requests oc- cur during this interval, although the interrupt will not be immediately serviced, the request flag will still be re- corded. If an interrupt requires immediate servicing while the program is already in another interrupt service routine, the EMI bit should be set after entering the rou- tine, to allow interrupt nesting. If the stack is full, the in- terrupt request will not be acknowledged, even if the related interrupt is enabled, until the Stack Pointer is decremented. If immediate service is desired, the stack must be prevented from becoming full. |
|
链接网址 |
| 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 |