亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 16c84的rb口中斷程序.txt

?? 包括很多單片機開發用的元代碼
?? TXT
字號:

  Interrupts - Part II, Interrupt on RB Change 
Introduction 

This discussion deals with the interrupt on RB change feature. It assumes the reader is familiar with the general discussion dealing with interrupts. 

The PIC16C84 and most other PICs provide a feature where the program may be configured such that an interrupt occurs when there is a change on any of a number of inputs. With the 16C84 (and 16C554/558), the interrupt is caused when there is a change on the upper nibble of Port B, i.e., RB.4::RB.7. 

This might be used as a power saving technique. The processor is placed in the sleep mode and is activated only when the user changes the state of any on the four inputs. The processor then performs the defined task and goes back to sleep. 

We are planning to use this feature in a 2000 event, 4 Channel event data logger. An event causes a change on any of the four inputs, waking the processor. The processor determines which of the four channels on which the event occurred. It will then fetch a 32-bit elapsed time in seconds from a Dallas DS1602. 32-bits accommodates an elapsed time of some 125 years, which is a bit much. Thus, only the lower 30 elapsed time bits will be used and the two bits associated with the channel will be inserted in the bit 31 and 30 positions. These four bytes will be saved to a Microchip 24LC65 (8K by 8) EEPROM. 

Details 

The general format of configuring for the Wake Up on Change interrupt is the same as with the external or timer / counter overflow interrupts. When ready for this interrupt, bit RBIE in the INTCON register is set which specifically indentifies the type of interrrupt that will be entertained. The GIE bit is then set. 

On interrupt, the program vectors to location 004H. Note that interrupts are now disabled. The processor then performs the defined task, the RBIF is then cleared and the processor then returns from the interrupt service routine using the RETFIE command. Note that interrupts are now enabled. 

There is a subtlety associated with the wake-up on change. PORTB must be read. The processor then stores a copy of the high nibble. The RBIF is then set and interrupt occurs when the high nibble of PORTB differs from this copy. Thus, it is important that in the interrupt service routine that PORTB be read so as to update the copy. 

The following incorrect code in the interrupt service routine caused us to do a good deal of head scratching. 

BCF INTCON, RBIF
MOVF PORTB, W

Indeed, we were clearing the interrupt flag. However, as the state of the high nibble of PORTB still differed from the old copy, the processor immediately set the RBIF flag and on RETFIE, we were immediately interrupted. In fact, the MOVF PORTB, F did us no good whatever. 

The correct code was; 

MOVF PORTB, W
BCF INTCON, RBIF

What a difference! In performing the MOVF PORTB, W, the old copy of the high nibble of PORTB is updated with the current state. The flag is then cleared. Thus, interrupt will occur when the high nibble of PORTB again changes. 
In the following routine, the intent was to identify the "channel" on which the change occurred. Thus, in TOP, PORTB is fetched and saved in ORIGINAL. 

In the interrupt service routine, PORTB is fetched and saved in NEW. Thus, the processor now has the new value as the basis for establishing if a future change occurs. The program then ascertains the specific bit which changed, and flashes an LED at a rate depending on which bit caused the interrupt. The NEW then becomes the ORIGINAL, the RBIF is cleared and when RETFIE is executed, control passes back to the main program with interrupts enabled. It is important to note that PORTB is read, thus updating the processor's copy prior to clearing RBIF. 

Note that considerable time is spent flashing the LED in the interrupt service routine. If any of the four bits on the high nibble of PORTB should change prior to clearing RBIF, RBIF will again be set by the hardware as there is a change from the latest copy. Thus, on RETFIE, interupts are again enabled and another interrupt will occur. However, this is eactly what is desired; a bit on the high nibble of PORTB changed. 

I am none too certain I have been any too clear. Always read PORTB so as to update the processor's reference prior to clearing RBIF. Failure to do so may cause a false interrupt as the processor compares the current state of the high nibble of PORTB with the most recent read. That is, the same change, which is in fact no change, will cause an interrupt. 

Note that in this routine, the W and STATUS registers were not saved on entry into the interrupt service routine and restored prior to exit as there was nothing of value to save. Rather, the processor simply goes to sleep and awaits the interrupt. 



; WAKE_UP.ASM
;
; This program is intended to illustrate the WAKE-UP on change feature
; associated with many PICs.
; 
; RB interrupts are enabled and the processor goes into a sleep mode. 
; On interrupt, the specific RB interrupt which caused the interrupt
; is determined and an LED is flashed 10 times at a speed determined 
; the input which changed. 
;
; Copyright, Locksley Haynes, Morgan State University, Nov 22, '97

LIST p=16c84
#include <c:\mplab\p16c84.inc>
__CONFIG 11H

CONSTANT LED=0 ; PORTA pin for LED

CONSTANT CH3=7 ; CH3 corresponds to PORTB.7
CONSTANT CH2=6
CONSTANT CH1=5
CONSTANT CH0=4 ; CH0 corresponds to PORTB.4

CONSTANT VARS=0CH

LOOP1 EQU VARS+0 ; outter timing loop
LOOP2 EQU VARS+1 ; inner timing loop
LED_CNT EQU VARS+2 ; times LED is winked


ORIGINAL EQU VARS+3
NEW EQU VARS+4
CHANGE EQU VARS+5
N EQU VARS+6

ORG 000H

CLRWDT
GOTO TOP

ORG 004H

GOTO WAKE_UP

TOP:
BCF OPTION_REG, 7 ; enable internal pullups
BSF STATUS, RP0
MOVLW 0F0H ; RB.7 - RB.4 are inputs
MOVWF TRISB
BCF STATUS, RP1

BTFSS STATUS, NOT_TO ; not a watch dog timer reset
GOTO TOP_1

; sample PORTB before going to sleep
MOVF PORTB, W ; fetch the current state
MOVWF ORIGINAL ; current state in high nibble

TOP_1:
BSF INTCON, GIE ; enable general interupts
BSF INTCON, RBIE ; enable interrupt on change

L1:
SLEEP
NOP
GOTO L1

WAKE_UP: ; interrupt service routine
MOVF PORTB, W ; sample changed state of pins
MOVWF NEW ; this will become the new original
XORWF ORIGINAL, W
MOVWF CHANGE ; 1's now in high nibble now identifies
; the bit that has changed
CLRF N ; set index to 0
BTFSC CHANGE, CH0
GOTO BLINK

INCF N, F ; N=1
BTFSC CHANGE, CH1
GOTO BLINK

INCF N, F ; N=2
BTFSC CHANGE, CH2
GOTO BLINK

INCF N, F
GOTO BLINK

BLINK: ; N is either 0, 1, 2 or 3 corresponding to the channel
; this is now mapped into a delay

CALL DELAY_LOOKUP
MOVWF LOOP1 ; save the delay in LOOP1
GOTO BLINK_AT_SPEED

DELAY_LOOKUP: ; map N into 100, 150, 200 or 250 msecs
MOVF N, W
ADDWF PCL, F
DT .100, .150, .200, .250

BLINK_AT_SPEED:
MOVLW .10
MOVWF LED_CNT
L2:
BSF PORTA, LED
CALL DELAY
CALL DELAY
BCF PORTA, LED
CALL DELAY
CALL DELAY
DECFSZ LED_CNT, F
GOTO L2
MOVF NEW, W
MOVWF ORIGINAL ; new original states 
BCF INTCON, RBIF ; clear interrupt flag
RETFIE

DELAY: 
L3:
MOVLW .110
MOVLW LOOP2
L4:
CLRWDT
NOP
NOP
NOP
NOP
NOP
NOP
DECFSZ LOOP2, F
GOTO L4
DECFSZ LOOP1, F
GOTO L3
RETURN

END

 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产剧情一区在线| 美脚の诱脚舐め脚责91 | 麻豆国产精品一区二区三区| 亚洲精品乱码久久久久久黑人| 国产精品乱人伦| 中文字幕日韩精品一区| 中文字幕av资源一区| 国产欧美日韩精品a在线观看| 精品国产乱码久久久久久久久| 日韩一区二区三区四区五区六区 | 日本特黄久久久高潮| 午夜精品久久久久久久99水蜜桃| 亚洲电影视频在线| 免费看日韩a级影片| 看电视剧不卡顿的网站| 狠狠色综合色综合网络| 国产美女在线精品| 日韩女优av电影在线观看| 91精品国产综合久久久久久久| 欧美日韩国产小视频| 日韩一级黄色片| 久久久99精品免费观看| 亚洲色图20p| 日韩av一区二区三区| 韩国理伦片一区二区三区在线播放| 另类综合日韩欧美亚洲| 粉嫩av一区二区三区在线播放 | 欧美日韩视频在线观看一区二区三区 | 成人精品视频.| 欧美在线你懂得| 欧美一区二区三区色| 久久久精品黄色| 一区二区三区四区视频精品免费| 亚洲成人av免费| 国产suv精品一区二区三区| 欧美综合亚洲图片综合区| 日韩欧美的一区| 亚洲日本va在线观看| 成人高清视频免费观看| 欧美综合在线视频| 国产亚洲福利社区一区| 亚洲综合男人的天堂| 国产一区二区成人久久免费影院| 成年人午夜久久久| 欧美tk丨vk视频| 亚洲影院理伦片| 国产电影一区二区三区| 欧美疯狂性受xxxxx喷水图片| 久久精品人人做人人综合| 洋洋成人永久网站入口| 国产suv一区二区三区88区| 欧美一区二区三区系列电影| 国产精品久久久久久久久久免费看 | 国产日韩av一区二区| 性做久久久久久久久| av男人天堂一区| 久久夜色精品国产噜噜av| 亚洲狠狠爱一区二区三区| 成人免费视频视频| 欧美一级高清大全免费观看| 极品少妇xxxx精品少妇| 91精品啪在线观看国产60岁| 亚洲伦在线观看| 成人污视频在线观看| 精品国产髙清在线看国产毛片| 亚洲国产视频直播| 91网站最新地址| 欧美国产在线观看| 国产毛片精品国产一区二区三区| 5月丁香婷婷综合| 午夜精品久久一牛影视| 在线观看欧美日本| 亚洲欧洲日产国码二区| 成人动漫一区二区在线| 国产色一区二区| 国产麻豆视频精品| 久久久久久久久蜜桃| 国产真实精品久久二三区| 欧美成人艳星乳罩| 久久国产尿小便嘘嘘| 欧美一级片免费看| 免费成人av在线| 精品国产乱码久久久久久浪潮| 经典三级在线一区| 国产人伦精品一区二区| 成人va在线观看| 一区二区三区资源| 欧美日韩一区国产| 看片的网站亚洲| 国产网站一区二区| 91在线观看高清| 亚洲高清久久久| 日韩一区二区三区高清免费看看| 精品一区二区影视| 日本一区二区三区在线观看| 日韩一区二区三区四区 | 精品国产一二三区| 国产大陆a不卡| 亚洲女厕所小便bbb| 欧美婷婷六月丁香综合色| 婷婷久久综合九色综合绿巨人| 欧美日韩国产一级| 国产精品资源站在线| 亚洲欧洲精品一区二区三区| 在线一区二区三区四区五区| 欧美aaaaaa午夜精品| 国产亚洲一区二区三区| 欧美在线观看一二区| 日本亚洲免费观看| 国产精品久久久一本精品| 欧美美女一区二区在线观看| 国内精品久久久久影院一蜜桃| 国产精品久久久久久久久果冻传媒| 色94色欧美sute亚洲线路一久| 日韩精品亚洲专区| 国产精品久久久久影院亚瑟| 欧美高清激情brazzers| 福利电影一区二区| 日本不卡的三区四区五区| 国产精品久久久久久久久图文区 | 91丨porny丨最新| 国产不卡在线播放| 夜夜嗨av一区二区三区四季av| 欧美一级在线免费| 91美女视频网站| 久久9热精品视频| 亚洲午夜激情av| 国产精品剧情在线亚洲| 欧美一区二区三区在线观看| 99久久99久久久精品齐齐| 日韩av中文字幕一区二区三区| 亚洲欧美视频一区| 久久久久一区二区三区四区| 欧美日韩一区二区三区免费看| 高清国产午夜精品久久久久久| 蜜桃91丨九色丨蝌蚪91桃色| 一个色综合av| 国产精品久线观看视频| 久久免费的精品国产v∧| 欧美日韩极品在线观看一区| 成人高清视频免费观看| 国产精品一二三区在线| 麻豆精品一区二区av白丝在线| 亚洲综合丝袜美腿| 亚洲欧美色图小说| 亚洲欧美怡红院| 国产精品免费视频网站| 欧美精品一区二区高清在线观看 | 欧美精品一区二区不卡| 欧美一区二区三区在线观看视频 | 日韩欧美高清一区| 欧美一区二区三区男人的天堂| 欧美午夜精品久久久久久孕妇| 色综合久久久久综合99| 91丨porny丨在线| 色婷婷精品久久二区二区蜜臀av | 久久精品国产77777蜜臀| 日韩国产精品久久| 日韩黄色一级片| 免费高清在线视频一区·| 免费在线一区观看| 日本高清不卡在线观看| 91理论电影在线观看| 91蜜桃网址入口| 欧洲人成人精品| 91精品国产综合久久蜜臀| 日韩亚洲欧美一区二区三区| 欧美变态口味重另类| 国产色产综合色产在线视频| 中文字幕 久热精品 视频在线 | 视频在线观看一区| 亚洲国产视频直播| 美女在线一区二区| 国产精品夜夜嗨| 91蜜桃传媒精品久久久一区二区| 欧美亚洲愉拍一区二区| 日韩一区二区在线观看| 国产欧美视频在线观看| 亚洲精品一二三四区| 亚洲成人在线网站| 激情六月婷婷久久| 91麻豆国产福利在线观看| 欧美最新大片在线看| 日韩欧美国产综合一区| 国产肉丝袜一区二区| 一区二区三区国产| 日韩av网站免费在线| 国产精品亚洲第一区在线暖暖韩国 | 91精品国产综合久久久蜜臀图片 | 亚洲午夜日本在线观看| 另类调教123区 | 欧美精品色一区二区三区| 26uuu国产一区二区三区| 亚洲色图制服诱惑| 麻豆freexxxx性91精品| 99re热视频精品| 怡红院av一区二区三区| 久久99精品国产麻豆婷婷洗澡| 91亚洲午夜精品久久久久久| 日韩亚洲国产中文字幕欧美|