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

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

?? hwgyjnkg.asm

?? 紅外感應節能開關
?? ASM
?? 第 1 頁 / 共 4 頁
字號:
.def	nightLightTimer = r25	;Zero if vacant, else timeout in 16-line-cycle units
.def	threshold = r26		;Occupancy sensor trip points, for negative-going edge
.def	pulseTimer = r27	;Times PIR pulse edges, in line cycles
.def	newSample = r28		;Latest ADC sample for occupancy detection
.def	eepAdrs = r29		;Address in EEPROM for next operation (Read/Write)
.def	counter = r30		;Also ZL, Used to index into SRAM (registers)
.def	ignoreTimer = r31	;Also ZH, If non-zero, the number of line cycles that must
							; elapse before the occupancy sensor input is again
							; considered valid (used to ignore transients introduced
							; by relay switching)
;
; Bits in the "status" register:
;
.equ	fStaUnused0 = 0		;** Unused and available **
.equ	fStaUnused1 = 1		;** Unused and available **
.equ	fStaUnused2 = 2		;** Unused and available **
.equ	fStaSwitchLoad = 3	;Set if relay is to be switched to opposite state
.equ	fStaFirstSeen = 4	;Set if first valid pulse has been seen from PIR
.equ	fStaProgram = 5		;Program Mode selected if high
.equ	fStaMode0 = 6		;Operating mode, encoded as two-bit field
.equ	fStaMode1 = 7
;
;-------------------------------------
;
; Microcontroller Part Programming Information
;
; The ATtiny15L part used for this firmware is designed to be programmed in-circuit,
; using an SPI interface. See the Atmel documentation for details.
;
; The programming sequence should be as follows:
;
; 1. Verify that the part is erased.
;
; 2. Read the factory oscillator calibration value from location $00 of the
;    device signature information, and program it into the low byte of the 
;    last word in the flash memory of the device (i.e., byte location 03FE hex).
;
; 3. Program the flash memory of the part with the appropriate file.
;
; 4. Program the fuse bits as follows:
;
;	BODLEVEL =	Unprogrammed	(Selects 4.0VDC brownout level)
;	BODEN 	 =	Unprogrammed	(Enables brownout detector)
;	SPIEN	 =	Programmed		(Enables SPI programming)
;	RSTDISBL = 	Programmed		(Disables RESET function of Pin 1)
;	CKSEL_1	 =	Programmed		(Selects fast startup clock, with
;	CKSEL_0	 =	Programmed		 brownout detector enabled)
;
; 5. Program both lock bits (1 & 2) to prohibit later examination of the code.
;
;-------------------------------------
;
; Occupancy Sensor Parameters
;
; The following parameters control the operation of the PIR occupancy sensor
; detection algorithm.
;
.equ	NOISE_OFFSET = 8		;Offset from noise peak to threshold = 0.1V
.equ	MIN_THRESH = 26			;Min threshold (max sensitivity) @ +/- 0.50V
.equ	MAX_THRESH = 61			;Max threshold (min sensitivity) @ +/- 1.2V
.equ	HOLD_THRESH = 87		;Hold-on threshold @ +/- 1.7V
.equ	MIN_PULSE = 3			;Min pulse width = 2 line cycles (0.05 seconds)
.equ	MIN_WIDTH = 30			;Minimum pulse spacing = 0.5 seconds
.equ	MAX_WIDTH = 120			;Maximum pulse spacing = 2.0 seconds
.equ	PIR_CENTER = 102		;Centerline of PIR ADC waveform = 2.0VDC
.equ	MAX_PIR = PIR_CENTER*2
.equ	DEF_NOISE = (MIN_THRESH - NOISE_OFFSET)
;
;-------------------------------------
;
; Oscillator Calibration
;
; The main internal oscillator of the ATtiny15 is tunable, and an ideal value for
; this tuning is chosen on a part-by-part basis by the factory. This value can be
; found in the high-order byte of address $000 of the signature address space. Because
; the firmware cannot directly read this area, the value is copied, during in-circuit-
; programming of the micro, into the highest word of the flash memory (low byte of $01FF).
;
; We use Timer 1, driven with a divider of 128 from the calibrated oscillator, to measure
; AC line cycle durations and delays. We can therefore calculate the expected half-cycle
; duration, for a 60Hz line, as:
;
; HALFCYC = (1600000 / 128) / 60 / 2 = 104.16666...
;
.equ	HALFCYC = 104
.equ	QUARTCYC = 52
.equ	FULLCYC = 208
;
;-------------------------------------
;
; Relay Timing Default Values
;
; The following constants define the default delay values, timed from the positive-
; to-negative half-cycle boundary, to the point at which the relay coil should be
; energized or deenergized, targetting the closure or opening of the contacts to
; occur just before the next positive-to-negative zero crossing (this due to the
; fact that the event can only be directly observed during the positive half-cycle
; of the AC waveform). All timing is done in Timer1 ticks, which as documented above
; is in 80uS increments.
;
.equ	ON_DEFAULT = QUARTCYC		;Assume close time < 12.5mS
.equ	OFF_DEFAULT = HALFCYC		;Assume open time < 8.3mS
.equ	BACKOFF = 2					;If late, move backwards by 160uS
;
;-------------------------------------
;
; Relay Switching Transient Lockout
;
; When the relay switches on or off, transients may be coupled into the occupancy
; sensor circuitry that can cause false trips. To mask these events, the firmware
; ignores all occupancy events for a preset number of line cycles after each relay
; switching operation.
;
.equ	IGNORE_CYC = 90	;Ignore all events for 1.5 seconds
;
;-------------------------------------
;
; Button Debouncing
;
; The front panel button is debounced by capturing its state once every line cycle,
; and maintaining a history of the last eight samples. A valid press is designated
; as three consecutive "down" samples after an "up" sample. The number of bits
; considered in this process can be modified by changing the following two constants:
;
.equ	DEBOUNCE_MASK = $0F		;Look at four most recent samples
.equ	DEBOUNCE_PRESS = $08	;Accept as a press one UP followed by three DOWN
.equ	DEBOUNCE_RELEASE = $01	;Accept as a release three DOWN followed by one UP
.equ	HOLD_CYC = 30			;Recognize button as held after 0.5 seconds
;
;-------------------------------------
;
; EEPROM Address Assignments
;
; The following variables are allocated storage in the non-volatile EEPROM area:
;
.equ	EE_VALID = $5A			; Bit pattern indicating that unit has passed the
								; manufacturing test sequence
.equ	EE_ERASED = $FF			; Bit pattern if virgin unit (EEPROM erased)

.eseg
eeValid:	.db	EE_ERASED		;Set to EE_VALID when manufacturing test
								; is completed successfully; if <> EE_VALID,
								; indicates virgin unit.
eeMode:		.db	MODE1			;Operating Mode
eeOnDelay:	.db	ON_DEFAULT		;Timer1 reload value for Relay On delay
eeOffDelay:	.db	OFF_DEFAULT		;Timer1 reload value for Relay Off delay

eeTimeouts:
eeTimeoutM1:	.dw	M1_TIMEOUT
eeTimeoutM2:	.dw	M2_TIMEOUT
eeTimeoutM3:	.dw	M3_TIMEOUT
eeTimeoutM4:	.dw	M4_TIMEOUT
eeTimeoutM5:	.dw	M5_TIMEOUT
eeModePatterns:
		.dw	0b1100000000000000	;Mode 1 (index=0)
		.dw	0b1101100000000000	;Mode 2 (index=1)
		.dw	0b1101101100000000	;Mode 3 (index=2)
		.dw	0b1101101101100000	;Mode 4 (index=3)
		.dw	0b1101101101101100	;Mode 5 (index=4)
;
; Manufacturing Test Patterns
;
; The nightlight flash sequences reported by the manufacturing test code are
; stored after the normal mode patterns, so that they can be invoked using the
; same supporting subroutines.
;
		.dw	0b1000000010000000	;Test failure #1 (index=5)
		.dw	0b1010000010100000	;Test failure #2 (index=6)
		.dw	0b1010100010101000	;Test failure #3 (index=7)
		.dw	0b1010101010101010	;Test passed (index=8)
;
;-------------------------------------

.cseg

;----- Interrupt Vectors -----------------------;
;
; The WN firmware does not presently use any interrupts; therefore, we can save
; flash memory space by knowing that they are not used. They are documented, in
; order, below, in case a future modification will require their use.
;
.org	0

		rjmp	Start		;Reset vector
;==		reti				;INT0 (should not occur)
;==		reti				;Pin Change (should not occur)
;==		reti				;Timer1 Compare Match A (should not occur)
;==		reti				;Timer1 Overflow (should not occur)
;==		reti				;Timer0 Overflow (should not occur)
;==		reti				;EEPROM Ready (should not occur)
;==		reti				;Analog Comparator (should not occur)
;==		reti				;ADC Conversion Complete (should not occur)

;----- Reset Entry Point -----------------------;
;
; This entry is reached under three conditions:
;
; - Initial power-on, or power-on from a "cold" condition, or
;
; - Brown-out reset, if Vcc drops below threshold (approx. 4.0VDC), or
;
; - Watchdog Timeout, which can occur if the AC line drops for a significant number
;   of line cycles, or a static hit derails the micro's PC
;
; In any case, the complete state of the device is reinitialized, and the load
; is returned to an OFF state, and any automatic operation is cancelled until the
; next time that the pushbutton is pressed.

Start:	in		temp0,MCUSR			; Determine cause of Reset, and
		sbrs	temp0,WDRF			; if caused by a Watchdog reset,
		rjmp	StartEEP2			; we must write down latest values
		ldi		eepAdrs,eeOnDelay	; of the relay timings into the
		rcall	ReadEEPROM			; nonvolatile memory (EEPROM),
		cp		temp0,onDelay		; if they have changed.
		breq	StartEEP1
		ldi		eepAdrs,eeOnDelay
		mov		temp0,onDelay
		rcall	WriteEEPROM
StartEEP1:
		rcall	ReadEEPROM
		cp		temp0,offDelay
		breq	StartEEP2
		ldi		eepAdrs,eeOffDelay
		mov		temp0,offDelay
		rcall	WriteEEPROM
StartEEP2:

		clr		ZH						; Initialize all of RAM (registers)
		ldi		ZL,30					; to zeroes for predictable behavior
Start1:	dec		ZL
		st		Z,ZH
		brne	Start1

		ldi		ZH,HIGH(FactoryOscCal*2)
		ldi		ZL,LOW(FactoryOscCal*2)
		lpm								; Read correct oscillator calibration
		out		OSCCAL,result			; and setup oscillator

		ldi		button,$FF				; Show button not pressed
		ldi		temp0,DEF_NOISE			; Preset noise integral
		mov		noiseH,temp0
		ldi		temp0,MIN_THRESH		; And start at maximum sensitivity
		mov		threshold,temp0

		ldi		temp0,PORTB_INIT		; Condition I/O port
		out		PORTB,temp0
		ldi		temp0,DDRB_INIT
		out		DDRB,temp0

		ldi		temp0,ADMUX_OCCUP		; Setup A/D converter
		out		ADMUX,temp0
		ldi		temp0,ADCSR_INIT		; Start ADC operation
		out		ADCSR,temp0

		sbi		ACSR,ACD				; Disable comparator to save power

		ldi		eepAdrs,eeMode			; Initialize mode,
		rcall	ReadEEPROM
		mov		mode,temp0
		rcall	ReadEEPROM				; and relay timing delays
		mov		onDelay,temp0
		rcall	ReadEEPROM
		mov		offDelay,temp0

		wdr								; Reset watchdog timer,
		ldi		temp0,WDTCR_INIT		; then start it, using an approximate
		out		WDTCR,temp0				; timeout of 0.4 seconds

		ldi		eepAdrs,eeValid			; Determine if this is a virgin unit,
		rcall	ReadEEPROM				; which should occur only in manufacturing
		cpi		temp0,EE_ERASED			; test.
		brne	MainLoop				; If EQ, not virgin unit.
;
; Manufacturing Tests
; -------------------
;
; The following sequence is executed on the initial, virgin unit power-up. It validates 
; certain accessible hardware parameters, and switches the relay to validate its operation.
; The results of the testing are reported in the nightlight LEDs as a flash pattern.
;
		rcall	Delay16Cycles		;Wait to allow power supply to stabilize
		ldi		temp0,MAX_MODE+1	;Assume initial test failure
		mov		mode,temp0
;
; Validate zero-crossing input
;
		ldi		temp0,TCCR1_INIT	;Ensure that zero-cross signal goes high
		out		TCCR1,temp0			;within less than one line-cycle
MfgTest1:	
		sbic	PINB,fZeroCross	;While the zero cross signal is low
		rjmp	MfgTest2		;we check the timing, and
		in		temp1,TCNT1		;if it exceeds a line cycle,
		cpi		temp1,FULLCYC	;we declare error type 1
		brlo	MfgTest1
		rjmp	MfgTestX

MfgTest2:
		out		TCNT1,zero		;Then clear the timer, and verify that
MfgTest3:
		sbis	PINB,fZeroCross	; the signal is seen as high
		rjmp	MfgTest4
		in		temp1,TCNT1
		cpi		temp1,FULLCYC
		brlo	MfgTest3		;If not seen low, report error type 1 
		rjmp	MfgTestX

MfgTest4:
		inc		mode			;Advance to error type 2
		ldi		temp0,(1<<PSR1)	;And reset the prescaler counter
		out		SFIOR,temp0		;as well, to increase predictability
		out		TCNT1,zero		;Finally, verify line cycle length to
MfgTest5:
		sbis	PINB,fZeroCross	; make sure that the oscillator calibration
		rjmp	MfgTest5		; has been properly programmed.
		in		temp1,TCNT1
		cpi		temp1,HALFCYC-3
		brlo	MfgTestX		;If < 8.08mS, report error type 2
		cpi		temp1,HALFCYC+4
		brsh	MfgTestX		;If > 8.56mS, report error type 2
;
; Validate relay operation
;
		inc		mode					;Advance to error type 3
MfgTest6:
		in		temp1,TCNT1				;Wait until middle of positive half-cycle
		cpi		temp1,HALFCYC+QUARTCYC	; to validate relay sense signal
		brne	MfgTest6

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕中文字幕一区二区| 久久激五月天综合精品| 欧美激情一区二区三区不卡| 日韩一级完整毛片| 91麻豆精品国产| 在线不卡中文字幕| 欧美久久一区二区| 337p亚洲精品色噜噜狠狠| 欧美日韩国产a| 678五月天丁香亚洲综合网| 欧美理论在线播放| 日本一区二区动态图| 久久久久久97三级| 国产精品婷婷午夜在线观看| 欧美国产亚洲另类动漫| 中文字幕一区二区三区在线播放 | 6080日韩午夜伦伦午夜伦| 制服丝袜亚洲精品中文字幕| 日韩欧美黄色影院| 久久久精品国产免费观看同学| 久久精品亚洲精品国产欧美| 国产精品日日摸夜夜摸av| 中文字幕中文字幕中文字幕亚洲无线| 中文字幕中文乱码欧美一区二区| 亚洲精选视频在线| 亚洲小说欧美激情另类| 免费视频一区二区| 国产精品99久久久| 97超碰欧美中文字幕| 91黄视频在线观看| 91精品国产综合久久久蜜臀图片| 欧美成人bangbros| 国产精品白丝在线| 视频一区中文字幕国产| 激情欧美日韩一区二区| 成人激情视频网站| 在线精品视频免费播放| 欧美一级xxx| 国产精品美女一区二区三区| 一区二区三区高清不卡| 另类的小说在线视频另类成人小视频在线| 国产精品亚洲专一区二区三区| 91丨九色丨国产丨porny| 91.com视频| 1024国产精品| 久久精品国内一区二区三区| 成人激情小说网站| 欧美一区二区三区的| 国产精品免费看片| 日本视频一区二区三区| 国产成人在线网站| 欧美日韩亚洲综合一区二区三区| 精品国产免费久久| 亚洲一级二级三级| 岛国av在线一区| 欧美一级二级三级乱码| 亚洲婷婷综合久久一本伊一区| 日韩精品五月天| av在线不卡免费看| 精品人在线二区三区| 国产一区二区影院| 欧美午夜精品久久久| 欧美激情在线一区二区三区| 日韩激情av在线| 91视视频在线观看入口直接观看www| 欧美一区二区视频在线观看2020 | 日韩在线a电影| 91尤物视频在线观看| 欧美草草影院在线视频| 亚洲综合色网站| 成人听书哪个软件好| 69久久夜色精品国产69蝌蚪网| 最好看的中文字幕久久| 国内精品免费在线观看| 欧美情侣在线播放| 亚洲蜜臀av乱码久久精品蜜桃| 国产露脸91国语对白| 555www色欧美视频| 亚洲最快最全在线视频| 成人av中文字幕| 久久男人中文字幕资源站| 亚洲一区二三区| 91麻豆蜜桃一区二区三区| 国产亚洲污的网站| 久久99精品国产麻豆婷婷| 欧美乱妇一区二区三区不卡视频 | 岛国av在线一区| 2021中文字幕一区亚洲| 免费成人在线视频观看| 欧美日韩成人在线一区| 一区二区三区四区激情| 97se亚洲国产综合自在线观| 国产精品国产自产拍高清av王其| 国产在线精品不卡| 精品国产乱码久久久久久久久| 日本成人在线网站| 欧美一级片免费看| 视频一区二区不卡| 777欧美精品| 日韩影院免费视频| 91精品国产91久久综合桃花| 午夜精品久久久久影视| 欧美日韩精品一区二区三区| 洋洋成人永久网站入口| 在线观看视频欧美| 一区二区三区欧美日| 色噜噜偷拍精品综合在线| 亚洲精品网站在线观看| 在线观看日韩高清av| 亚洲高清中文字幕| 欧美日韩第一区日日骚| 蜜桃精品视频在线| 日韩免费福利电影在线观看| 久久精品国产在热久久| 欧美精品一区二区三区四区 | 狠狠色狠狠色综合系列| 久久综合狠狠综合久久激情 | 欧美成人aa大片| 国产一区二区三区高清播放| 国产亚洲欧美激情| caoporn国产一区二区| 日韩毛片精品高清免费| 在线视频中文字幕一区二区| 香港成人在线视频| 日韩亚洲欧美综合| 国产成人精品影视| 亚洲视频香蕉人妖| 在线电影欧美成精品| 国内精品久久久久影院色| 中文字幕精品三区| 91久久久免费一区二区| 琪琪久久久久日韩精品| 久久人人97超碰com| 不卡免费追剧大全电视剧网站| 亚洲激情av在线| 91精品国产综合久久久久久| 国产一区不卡精品| **网站欧美大片在线观看| 91麻豆精品91久久久久久清纯 | 成人免费毛片高清视频| 亚洲国产成人av好男人在线观看| 欧美大片日本大片免费观看| 成人免费看黄yyy456| 亚洲一区二区三区美女| 日韩欧美视频一区| av亚洲产国偷v产偷v自拍| 亚洲成人av一区二区三区| 精品免费一区二区三区| 97精品国产97久久久久久久久久久久 | 中文字幕日本不卡| 欧美日本国产一区| 国产高清一区日本| 亚洲第一狼人社区| 国产欧美日韩另类视频免费观看| 欧美无砖砖区免费| 国产高清成人在线| 午夜私人影院久久久久| 国产蜜臀97一区二区三区| 欧美酷刑日本凌虐凌虐| 99在线精品观看| 久久 天天综合| 亚洲自拍都市欧美小说| 久久综合九色综合97婷婷女人| 欧美自拍偷拍午夜视频| 国产精品一卡二卡| 婷婷综合另类小说色区| 国产精品福利一区| 欧美tickling挠脚心丨vk| 色婷婷av一区| 国产成人精品免费一区二区| 香蕉成人伊视频在线观看| 国产精品美女久久久久高潮| 日韩精品一区二区三区在线播放| 91免费观看视频在线| 国产一区不卡视频| 男女性色大片免费观看一区二区| 成人欧美一区二区三区黑人麻豆 | 亚洲在线成人精品| 国产人成亚洲第一网站在线播放 | 精品国免费一区二区三区| 欧美综合在线视频| 国产不卡免费视频| 精品在线一区二区| 日韩电影在线观看电影| 亚洲综合一二区| 国产精品久久久久四虎| 精品嫩草影院久久| 欧美一区二区视频在线观看2022 | 欧美α欧美αv大片| 欧美日韩国产一级| 在线视频国内自拍亚洲视频| 成人一级片在线观看| 国产在线播放一区| 久久66热偷产精品| 精品在线一区二区三区| 精品在线播放午夜| 久久99深爱久久99精品| 免费在线观看日韩欧美| 美女视频黄频大全不卡视频在线播放 | 免费人成精品欧美精品|