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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? 10ftouch.asm

?? 基于microchip PIC10F系列的芯片進(jìn)行觸摸感應(yīng)設(shè)計(jì)的源代碼
?? ASM
字號:
;********************************************************
;* file: 10ftouch.asm                           ver 1.2 *
;* auth: m. flipse                                      *
;* date:                                                *
;*
;* modf: T. Perme
;* date: 24 March 2008
;* desc: 
;*
;* Software License Agreement
;*
;* The software supplied herewith by Microchip Technology
;* Incorporated (the "Company") is intended and supplied to you, the
;* Company抯 customer, for use solely and exclusively on Microchip
;* products. The software is owned by the Company and/or its supplier,
;* and is protected under applicable copyright laws. All rights are
;* reserved. Any use in violation of the foregoing restrictions may
;* subject the user to criminal sanctions under applicable laws, as
;* well as to civil liability for the breach of the terms and
;* conditions of this license.
;*
;* THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
;* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
;* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
;* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
;* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
;* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
;*
;********************************************************

        processor pic10f206
        radix   dec

        include <p10f206.inc>
        include "Vars.inc"

gatedtime       equ     .33     	; time in msec that is used to measure the frequency

avdepth         equ     .5     		; averaging depth
                                	;    2 ^ (n-1) x oldvalue + newvalue
                                	; = ---------------------------------
                                	;               (2 ^ n)

; For Proximity
triplo_prx      equ     .16     	; difference between average and current
triphi_prx      equ     .0      	; frequency value for a key to be detected. (512 counts)
									; Smaller values have a more sensitive trip (good for proximity)
; For Touch
triplo_tch      equ     .50      	; difference between average and current
triphi_tch      equ     .1      	; frequency value for a key to be detected. (512 counts)
									; Smaller values have a more sensitive trip (good for proximity)

hysteresis      equ     .200    	; constant that is used to lower the averagevalue

                                	; when continuous touch is enabled

        __config  _intrc_osc & _wdt_on & _mclre_off & _cp_off
        


        org     .0      	        ; reset vector
reset
        movwf   osccal	            ; calibrate internal oscillator

		; If waking from intentional sleep, return back to post-sleep command
		; CWUF = 0, GPWUF = 0, TO = 0, PO = 0        STATUS BITS for wake from WDT
;		movf	STATUS, w
;		andlw	b'11111000'			; and off ALU status bits to zero
;		btfsc	STATUS, Z			; check if all bits are zero, branch accordingly
;		goto	jumpbackaftersleep	; all zero
;		goto	jumpinit			; non-zero

jumpbackaftersleep:
;		clrwdt						; Clr wdt, resetting PO and TO to 1 in status reg
;		goto	wake_from_sleep
		
jumpinit:		
        call    init				;  init the device if starting from power-up
        goto    main

;********************************************************
;* subroutine init                                      *
;********************************************************
;{
init    
        movlw   b'11110111'
              ;   ||||||||_ ps0
              ;   |||||||__ ps1
              ;   ||||||___ ps2   set prescaler to 1:256
              ;   |||||____ psa   prescaler assigned to tmr0
              ;   ||||_____ t0se  increment on high to low
              ;   |||______ t0cs  transition on t0cki
              ;   ||_______ #gppu pull-ups disabled
              ;   |________ #gpwu wake-up on pin change disabled
        option

        movlw   b'00001011'
              ;   ||||||||_ #cwu    wake-up on comp change disabled
              ;   |||||||__ cpref   pos ref is cin+
              ;   ||||||___ cnref   neg ref is internal 0.6V reference
              ;   |||||____ cmpon   comparator on
              ;   ||||_____ cmpt0cs comparator output used as tmr0 clock
              ;   |||______ pol     output is inverted
              ;   ||_______ #couten output is placed on cout pin
              ;   |________ cmpout  -read only bit-
        movwf   cmcon0

        movlw   b'11111001'     ; set gp1 and gp2 as an output
        tris    gpio

        clrf    averagehi
        clrf    averagelo
        clrf    averagefraction
        
        clrf    userflag

        retlw   .0
;}

;********************************************************
;* subroutine delay                                     *
;* descr: causes a timing delay in mSecs                *
;*                                                      *
;* in:    w - value in mSecs                            *
;********************************************************
;{
delay
        movwf   temp1
wait
        movlw   .249
        movwf   temp2
           clrwdt				; instead of nop, use clrwdt to clrwdt while awake
           decfsz  temp2		; all other code is much much less than 18ms (WDT timeout) when not delaying
           goto    $-2

        decfsz  temp1
        goto    wait
        retlw   .0
;}
;********************************************************
;* subroutine: average
;* descr: 
;*
;* in:    freqhi, freqlo                                *
;********************************************************
;{
average
        movf    averagehi,w
        movwf   avhitemp
        movf    averagelo,w
        movwf   avlotemp
        clrf    temp2           ; make a copy of the original value

        call    divideby2pwrn   ; divide the copy by 2^n
;******
        movf    temp2,w
        subwf   averagefraction ; and subtract the result from the original
        btfsc   status,c
        goto    hopover
        decf    averagelo
        movlw   .255
        xorwf   averagelo,w
        btfsc   status,z
        decf    averagehi           
hopover
        movf    avlotemp,w
        subwf   averagelo
        btfss   status,c
        decf    averagehi

        movf    avhitemp,w
        subwf   averagehi       ; average - 1/(2^n)
;******
        movf    freqhi,w
        movwf   avhitemp
        movf    freqlo,w
        movwf   avlotemp        ; make a copy of the original value
        clrf    temp2

        call    divideby2pwrn   ; divide by 2^n

        movf    temp2,w
        addwf   averagefraction
        btfss   status,c
        goto    hopover2
        incf    averagelo
        btfsc   status,z
        incf    averagehi
hopover2
        movf    avlotemp,w
        addwf   averagelo
        btfsc   status,c
        incf    averagehi
        movf    avhitemp,w
        addwf   averagehi

        retlw   .0

divideby2pwrn
        movlw   avdepth
        movwf   temp1
shift1
        bcf     status,c
        rrf     avhitemp
        rrf     avlotemp
        rrf     temp2
        decfsz  temp1
        goto    shift1
        retlw   .0
;}
;********************************************************
;* subroutine: checkdifference                          *
;* descr: subtracts actual value from average           *
;*                                                      *
;* out:   freqhi:freqlo  with frequency                 *
;********************************************************
;{
checkdifference
        movf    averagehi,w
        movwf   differencehi
        movf    averagelo,w
        movwf   differencelo    ; make a copy of the averagevalue

        movf    freqlo,w
        subwf   differencelo
        btfss   status,c
        decf    differencehi
        movf    freqhi,w
        subwf   differencehi    ; averagevalue - currentvalue

        btfsc   status,c        ; is the difference negative?
        goto    evaldifference  ; no positive, check if it exceeds the trip point
        movf    freqhi,w        ; yes, key is released
        movwf   averagehi       ; average should follow actual value
        movf    freqlo,w
        movwf   averagelo
        clrf    differencehi
        clrf    differencelo
        bcf     userflag,keydown

        retlw   .0

evaldifference
        bcf     userflag,keydown

		movlw	triphi_tch
		btfsc	gpio, 3
        movlw   triphi_prx
        subwf   differencehi,w
        btfss   status,z        ; are hi bytes equal?
        goto    results


		movlw	triplo_tch
		btfsc	gpio, 3
        movlw   triplo_prx      ; yes, compare lower bytes
        subwf   differencelo,w
results

        btfss   status,c        ; was the difference > trip point?
        retlw   .0              ; no, return

        bsf     userflag,keydown ; yes, set the keydown flag

        retlw   .0
;}
;********************************************************
;* subroutine: getfrequency                             *
;* descr: converts to binary coded decimal              *
;*                                                      *
;* out:   freqhi:freqlo  with frequency                 *
;********************************************************
;{
getfrequency
        movlw   b'11110111'
              ;   ||||||||_ ps0
              ;   |||||||__ ps1
              ;   ||||||___ ps2   set prescaler to 1:256
              ;   |||||____ psa   prescaler assigned to tmr0
              ;   ||||_____ t0se  increment on high to low
              ;   |||______ t0cs  transition on t0cki
              ;   ||_______ #gppu pull-ups disabled
              ;   |________ #gpwu wake-up on pin change disabled
        option

        movlw   b'00001011'
              ;   ||||||||_ #cwu    wake-up on comp change disabled
              ;   |||||||__ cpref   pos ref is cin+
              ;   ||||||___ cnref   neg ref is internal 0.6V reference
              ;   |||||____ cmpon   comparator on
              ;   ||||_____ cmpt0cs comparator output used as tmr0 clock
              ;   |||______ pol     output is inverted
              ;   ||_______ #couten output is placed on cout pin
              ;   |________ cmpout  -read only bit-
        movwf   cmcon0
        
        movlw   .255            ; frequency will be stored in freqhi:freqlo
        movwf   freqlo          ; freqlo is pre-initialised here

        clrf    tmr0            ; clear tmr0 and the 1:256 prescaler
        movlw   gatedtime
        call    delay           ; wait N mSec for scan time

        bcf     cmcon0,cmpon    ; turn off oscillator

        movf    tmr0,w          ; high byte of value is stored in tmr0
        movwf   freqhi          ; low value is still in the prescaler

; To get the value from the prescaler (which is not directly readable),
; the clock source for tmr0 is changed to Fosc/4.
; Next the value of tmr0 is observed. The time is takes for the next
; increment is an indication of the value of the prescaler.

        movlw   b'11010111'     ; change clock source to Fosc/4
        option

measureprescaler
        incf    freqlo          ; was initialised to 255 and set to 0 here
        movf    tmr0,w          ; get the current value of tmr0
        xorwf   freqhi,w        ; compare it with the original value of tmr0
        btfsc   status,z        ; did tmr0 increment?
        goto    measureprescaler ; no, loop and increment freqlo

; Now freqlo ranges from 0 to 43. The next section will muliply it
; with 6 and clipped to 255, to get the lobyte of the frequency count.

        bcf     status,c        ; clear the carry bit
        rlf     freqlo          ; muliply by 2
        rlf     freqlo ,w       ; and muliply by 2 again, but put the result in w
        addwf   freqlo          ; add it to the doubled value (multiplied by 6)
        btfss   status,c        ; did it overflow (6 x 43 = 258)
        goto    nooverflow      ; no, go on
        movlw   .255            ; yes, clip it to 255
        movwf   freqlo 

nooverflow
        comf    freqlo          ; the time for the prescaler to roll over was measured,
                                ; so its value was 255 - prescaler value

; Because of the way the prescaler rollover time was measured (6 Tcy in measureprescaler),
; atleast the 2 least significant bits in freqhi:frequlo are useless.
; Therefore the final result is divided by 4.

        bcf     status,c
        rrf     freqhi
        rrf     freqlo
        bcf     status,c
        rrf     freqhi
        rrf     freqlo          ; divide by 4


		bcf		cmcon0, cmpon	; turn comp off to conserve power

        retlw   .0              ; done
;}



;********************************************************
;* main                                                 *
;********************************************************
;{
main
        movlw   gatedtime
        call    delay           ; wait 30mSec

        movlw   .49
        movwf   differencelo
        movlw   .1
        movwf   differencehi
        call    evaldifference
        
        nop

        call    getfrequency
        movf    freqhi,w
        movwf   averagehi
        movf    freqlo,w
        movwf   averagelo


mainloop
		; Sensing and Detection
        call    getfrequency
        call    average
        call    checkdifference

		; Check if Key Was Pressed
		btfsc	userflag, keydown
		goto	react_keydown
		btfss	userflag, keydown
		goto	react_keyup

		; If a press was detected, output low (LED ON) else output high (LED OFF)
react_keydown:
		bcf		gpio, output			; turn led on
		goto	finish_loop
react_keyup:
		bsf		gpio, output			; turn led off
		goto	finish_loop


		; Code below was left in to show possible use of sleeping and waking via WDT
		; to significantly reduce power.  Requires code on power up (also commented)
		; in order to determine that it is a wake from sleep, not power up in order
		; to resume normal operation		

finish_loop:	
		; Sleep
 ; 		movlw   b'11111011'				; Prescalar on 1:8 WDT, assign to WDT
 ;  	option
 ;		movlw	.1
 ;		call	delay					; delay for 1 ms to ensure comparator off, everything settled before sleep
 ;		sleep							; goto sleep for ~144ms (8*18ms)
 ;		nop								; don't pre-fetch anything unintended after sleep instruction
 ;      Sleep Code Commented out
		
		; Sleeping more between scans will reduce avg current
		; 33ms on, 144ms off avg draw =  ~70uA		WDT prescale 1:8	(5.6scan per sec)
		; 33ms on, 288ms off avg draw =  ~50ua		WDT prescale 1:16	(3.1scan per sec)

		
wake_from_sleep:
 ;  	movlw   b'11110111'				; Return Prescalar to 1:256 assigned to TMR0
 ;   	option							; re-init option reg
 ;		movlw	b'00001011'
 ;		movwf	cmcon0					; re-init cmcon0
 ;		movlw	b'11111001'
 ;		tris	gpio					; re-init gpio
 ;      Sleep code commented
	
		goto	mainloop				; stay in main loop


;---------------------------------------------------------------------       
        end

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕免费观看一区| 国产成人av一区二区三区在线观看| 91精品国产一区二区三区香蕉| 最新国产精品久久精品| 99精品视频一区二区三区| ●精品国产综合乱码久久久久| 一本到一区二区三区| 亚洲成av人影院| 日韩一卡二卡三卡国产欧美| 国产在线精品一区二区| 国产精品乱码一区二区三区软件| www.欧美日韩国产在线| 亚洲观看高清完整版在线观看| 欧美精品自拍偷拍| 国产一区二区按摩在线观看| 国产精品卡一卡二卡三| 在线一区二区三区四区五区| 蜜臀av性久久久久蜜臀aⅴ| 久久亚区不卡日本| 成人动漫av在线| 亚洲成人黄色小说| 久久久午夜精品理论片中文字幕| 成人午夜看片网址| 亚洲电影欧美电影有声小说| 精品国产乱码久久久久久夜甘婷婷| 成人午夜又粗又硬又大| 亚洲一区二区三区四区五区黄| 欧美v国产在线一区二区三区| 东方aⅴ免费观看久久av| 亚洲综合偷拍欧美一区色| 91精品国产乱| 91美女蜜桃在线| 国产精品白丝jk黑袜喷水| 亚洲午夜日本在线观看| 欧美高清在线一区二区| 欧美网站大全在线观看| 国产精品1区2区3区在线观看| 亚洲国产三级在线| 国产亚洲精品超碰| 91精品国产高清一区二区三区 | 久久国产精品无码网站| 亚洲色图在线视频| 精品久久国产字幕高潮| 在线观看视频一区| 成人性生交大合| 日韩国产一区二| 中文字幕人成不卡一区| 精品黑人一区二区三区久久| 欧美色偷偷大香| 91蜜桃免费观看视频| 成人小视频在线观看| 久久av中文字幕片| 日韩中文欧美在线| 亚洲综合精品自拍| 亚洲视频在线观看一区| 久久九九99视频| 欧美一区在线视频| 欧美日韩国产另类不卡| 91丝袜美腿高跟国产极品老师| 国产黑丝在线一区二区三区| 麻豆精品在线看| 日韩精品一二三区| 偷拍与自拍一区| 亚洲国产成人tv| 亚洲无人区一区| 午夜视频在线观看一区| 一区二区三区在线影院| 亚洲天堂精品视频| 国产精品私房写真福利视频| 久久精品在这里| 国产日韩精品一区| 欧美国产一区在线| 国产精品久久综合| 成人欧美一区二区三区1314| 中文字幕一区二区三区乱码在线| 国产视频一区二区在线| 国产亲近乱来精品视频| 久久欧美中文字幕| 国产三级欧美三级日产三级99| 久久久不卡网国产精品一区| 久久久久久久综合日本| 久久久久久9999| 国产精品家庭影院| 亚洲图片激情小说| 亚洲综合在线第一页| 亚洲国产一区二区视频| 五月开心婷婷久久| 免费在线看成人av| 国产一本一道久久香蕉| 成人精品一区二区三区四区| 91丝袜高跟美女视频| 欧美日韩aaaaaa| 日韩精品专区在线影院观看| 精品国产三级电影在线观看| 国产欧美日本一区二区三区| 亚洲婷婷在线视频| 亚洲综合色成人| 免费成人在线观看| 丁香亚洲综合激情啪啪综合| 91玉足脚交白嫩脚丫在线播放| 欧美撒尿777hd撒尿| 日韩一区二区精品葵司在线| 国产女同性恋一区二区| 一区二区三区日韩精品| 美女一区二区视频| 成人app网站| 88在线观看91蜜桃国自产| 亚洲精品在线网站| 亚洲精品精品亚洲| 奇米777欧美一区二区| 国产白丝网站精品污在线入口| 欧美吻胸吃奶大尺度电影| 精品久久久久久久久久久久久久久 | 日精品一区二区三区| 国产精品资源网| 欧美午夜一区二区| 久久久久亚洲综合| 亚洲成在线观看| 成人的网站免费观看| 91精品国产色综合久久不卡蜜臀 | 国产精品电影一区二区| 亚洲高清免费视频| 国产在线视视频有精品| 欧美在线观看一区二区| 国产无一区二区| 日韩一区欧美二区| 91亚洲永久精品| 日韩欧美黄色影院| 亚洲国产一二三| 99vv1com这只有精品| 精品国精品自拍自在线| 亚洲一区二区三区自拍| 成人av电影在线播放| 亚洲精品一区二区精华| 午夜在线电影亚洲一区| 99久久国产免费看| 久久久精品国产免费观看同学| 首页综合国产亚洲丝袜| 色哟哟一区二区三区| 日本一区二区三区久久久久久久久不| 天堂影院一区二区| 欧美性高清videossexo| 亚洲欧美日韩国产综合在线| 国产一区二区三区| 日韩一区二区在线观看视频播放| 亚洲激情自拍视频| 99精品久久久久久| 国产精品久久久久久久久免费相片| 久久成人免费网站| 欧美一区二区视频网站| 五月婷婷综合网| 在线看一区二区| 亚洲欧美一区二区三区极速播放| 国产精品99久久久| 久久久99免费| 国产精品自拍av| 久久精品在线免费观看| 国产一区二区三区免费播放| 日韩一区二区在线看| 美日韩一区二区三区| 欧美男男青年gay1069videost| 亚洲男女毛片无遮挡| 91在线你懂得| 一区二区免费看| 色94色欧美sute亚洲线路二 | 中文字幕va一区二区三区| 国产成人h网站| 欧美国产综合色视频| 成人黄色小视频在线观看| 国产精品大尺度| 91在线视频免费91| 一区二区三区毛片| 欧美精品777| 蜜桃av噜噜一区| 国产亚洲精品aa午夜观看| 高清久久久久久| 中文字幕欧美一| 欧美伊人久久久久久久久影院 | 亚洲免费伊人电影| 一本一道久久a久久精品综合蜜臀| 亚洲视频一区在线观看| 欧美三区在线观看| 免费成人在线观看| 国产欧美日韩视频在线观看| eeuss鲁片一区二区三区| 亚洲精品视频在线| 欧美欧美欧美欧美| 极品少妇xxxx精品少妇| 亚洲国产精品二十页| 色婷婷av一区二区三区大白胸 | 国产一区二区不卡在线| 欧美激情资源网| 色八戒一区二区三区| 五月综合激情网| 久久天天做天天爱综合色| 粉嫩av亚洲一区二区图片| 亚洲色图制服丝袜| 日韩欧美精品三级| av午夜一区麻豆| 男男gaygay亚洲|