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

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

?? pickit.asm

?? pic16c745 的 firmware的一個usb樣例,供大家參考
?? ASM
?? 第 1 頁 / 共 2 頁
字號:
	call	PopByte		; load LSB
	movwf	AWord
	clrf	AWord+1		; clear high order byte
	movlw	AWord+1
	movwf	FSR
	movf	AWord,w
	call	Write14		; send byte to device
	
	call	BeginProgramCycle ; wait 8ms between BeginProgramCycle
	call	Delay		  ;  and Delay
	call	IncrementPC	; increment PC to prepare for next write
	return

;******************************************************************************
; IncrementPC
;  Issues Increment Program Counter command once. ProgramCntr is incremented to
;  coinside with PIC12F629/675 programm counter.
;   Inputs:	none
;   Outputs:	none
;******************************************************************************
IncrementPC
	incf	ProgramCntr,f	; Increment 16 bit program counter tracker
	btfsc	STATUS,Z
	incf	ProgramCntr+1,f
	movlw	INCRADDRESS	; send increment address command
	call	SendCommand
	return

;******************************************************************************
; IncrementPCmulti
;  Issues Increment Program Counter command the number of times specifed in the
;  word to follow this command.	
;   Inputs:	1 word containing number of times to increment 
;   Outputs:	none
;******************************************************************************
IncrementPCmulti
	call	PopByte		; pop LSB
	movwf	counter
	call	PopByte		; pop MSB
	movwf	counter+1	
	iorwf	counter,w	; is 16 bit counter a zero?
	btfsc	STATUS,Z
	return			; yes, then return
	incf	counter+1,f	; no, then increment MSB once (if this isn't 
				;  done the following loop will not execute the
				;  appropriate amount of times)
IncrementLoop
	incf	ProgramCntr,f	; increment device program counter tracker
	btfsc	STATUS,Z
	incf	ProgramCntr+1,f
	movlw	INCRADDRESS	; send increment address command
	call	SendCommand	
	decfsz	counter,f	; repeat if necessary
	goto	IncrementLoop
	decfsz	counter+1,f
	goto	IncrementLoop
	return
	
;******************************************************************************
; BeginProgramCycle
;  Program device...  Sends the command and delays ~4mS before returning
;   Inputs:	none
;   Outputs:	none
;******************************************************************************
BeginProgramCycle
	movlw	BEGINPROGRAMMING ; send the Program command to the device
	call	SendCommand
	call	Delay		; 4ms delay
	return

;******************************************************************************
; ReadProgram
;  Read Program memory, send the data to the USB In Buffer
;   Inputs:	none
;   Outputs:	4 words of program memory
;******************************************************************************
ReadProgram
	movlw	4		; read 4 words at a time
	movwf	counter	
ReadProgLoop
	movlw	READPGMMEM	; send read program memory command
	call	SendCommand
	call	Read14		; get the word 
	movwf	AWord
	movf	INDF,w
	movwf	AWord+1
	movf	AWord,w
	call	TxByte		; send LSB to transfer buffer
	movf	AWord+1,w
	call	TxByte		; send MSB to transfer buffer
	call	IncrementPC	; increment program counter
	decfsz	counter,f	; repeat 4 times
	goto	ReadProgLoop
	return

;******************************************************************************
; ReadEEData
;  Read Data memory, send the data to the USB In Buffer
;   Inputs:	none
;   Outputs:	8 bytes of data memory
;******************************************************************************
ReadEEData
	movlw	8		; read 8 bytes at a time
	movwf	counter
ReadEELoop
	movlw	READDATAMEM	; send read data memory command
	call	SendCommand
	call	Read14		; get the byte
	call	TxByte		; send the byte to the transfer buffer
	call	IncrementPC	; increment program counter
	decfsz	counter,f	; repeat 8 times
	goto	ReadEELoop
	return

;******************************************************************************
; CalcChecksum
;  Calculate the checksum of the device, with the size of the device specified
;  by the host.
;   Inputs:	4 bytes
;		(one word specifing length of program memory)
;		(one word specifing length of data memory)
;   Outputs:	3 bytes
;		(one word containing program memory checksum, including
;		 configuation bits, or code protected checksum)
;		(one byte containing data memory checksum)
;******************************************************************************
CalcChecksum
	call	EnterProgramMode
	clrf	CheckSum
	clrf	CheckSum+1	; clear the sum
	clrf	CheckSum+2
	call	Delay
CheckConfigWord
	call	WriteConfig	; point PC to Configuration memory
	movlw	7
	movwf	counter		
CheckConfigWordLoop
	call	IncrementPC	; bump PC to 2007 (location of Config word)
	decfsz	counter,f
	goto	CheckConfigWordLoop	
	
	movlw	READPGMMEM	; Get Configuration Word
	call	SendCommand
	call	Read14
	movwf	CheckSum	; move low order byte into checksum
	movf	INDF,w
	andlw	0x01		; mask with one
	movwf	CheckSum+1	; move high order byte into checksum
	
;	btfsc	CheckSum+1,0	; is data code protection bit set?
;	goto	CheckSumNoProtect ; no, calculate non-code protect checksum
	btfsc	CheckSum,7	; is program memory code protection enabled?
	goto	CheckSumNoProtect ; no, calculate non-code protect checksum

CheckSumProtect			; if yes to both then computate checksum 	
				;  for code protected part
	call	ExitProgramMode	; Must cycle out and into programming
				;  mode to initialize Program Counter
	call	Delay
	call	EnterProgramMode
	call	Delay			
	call	WriteConfig	; Jump to Configuration Memory again
	clrf	AWord
	clrf	AWord+1
	movlw	4
	movwf	counter
CheckSumProtectLoop
	movlw	READPGMMEM	
	call	SendCommand
	call	Read14	
	andlw	0x0F
	iorwf	AWord,f
	decf	counter,f
	btfsc	STATUS,Z
	goto	CheckSumProtectEnd
	call	IncrementPC
	movlw	4		
	movwf	counter+1
	bcf	STATUS,C	; clear carry flag			
LoopDLoop
	rlf	AWord,f		; shift left four bits
	rlf	AWord+1,f	; shift left four bits
	decfsz	counter+1,f
	goto	LoopDLoop
	goto	CheckSumProtectLoop
CheckSumProtectEnd	
	movf	AWord,w
	addwf	CheckSum,f
	btfsc	STATUS,C
	incf	CheckSum+1,f
	movf	AWord+1,w
	addwf	CheckSum+1,f
	call	PopByte		; clear command parameters from buffer
	call	PopByte
	call	PopByte
	call	PopByte
	goto	EndCheckSum	

CheckSumNoProtect
	call	ExitProgramMode	; Must cycle out and into programming
				;  mode to initialize Program Counter
	call	EnterProgramMode
	call	Delay
	
	call	PopByte		; get the length of memory to checksum
	movwf	counter		
	call	PopByte
	movwf	counter+1
	incf	counter+1,f	
ProgCheckSumLoop
	call	ReadCheckSum	; read word, sum into checksum	
	call	IncrementPC	; bump PC
	decfsz	counter,f	
	goto	ProgCheckSumLoop
	decfsz	counter+1,f
	goto	ProgCheckSumLoop
DataCheckSum
	call	ExitProgramMode	; Must cycle out and into programming
				;  mode to initialize Program Counter
	call	EnterProgramMode
	call	Delay
	
	call	PopByte		; get the length of memory to checksum
	movwf	counter		
	call	PopByte
	movwf	counter+1
	incf	counter+1,f	
DataCheckSumLoop
	call	ReadDataCheckSum ; read word, sum into checksum	
	call	IncrementPC	 ; bump PC
	decfsz	counter,f	
	goto	DataCheckSumLoop
	decfsz	counter+1,f
	goto	DataCheckSumLoop
	
EndCheckSum
	call	ExitProgramMode	; Exit Programming Mode
	movf	CheckSum,w	; now send the checksum back to host
	movwf	TxBuffer
	movf	CheckSum+1,w
	movwf	TxBuffer+1
	movf	CheckSum+2,w
	movwf	TxBuffer+2	
	movlw	TxBuffer
	movwf	FSR
	goto	TxLoop		; send data to host

; Read a program word and sum it into the checksum
ReadCheckSum
	movlw	READPGMMEM
	call	SendCommand
	call	Read14
	addwf	CheckSum,f	; add low order byte into checksum
	btfsc	STATUS,C	; if it overlows, add one to high
	incf	CheckSum+1,f	;  order byte
	movf	INDF,w
	addwf	CheckSum+1,f	; add high order byte into checksum
	return
	
; Read a data byte and sum it into the checksum
ReadDataCheckSum
	movlw	READDATAMEM
	call	SendCommand
	call	Read14
	addwf	CheckSum+2,f
	return


;******************************************************************************
; ReportVersion
;  Report the Version number
;   Inputs:	none
;   Outputs:	none
;******************************************************************************	
ReportVersion
	movlw	MAJORVERSION
	movwf	TxBuffer
	movlw	MINORVERSION
	movwf	TxBuffer+1
	movlw	DOTVERSION
	movwf	TxBuffer+2
	movlw	TxBuffer
	movwf	FSR
	goto	TxLoop		; send data to host

;******************************************************************************
; PowerControl
;  Turn Vdd On and Off. Turn 5kHz pwm on and off.
;   Inputs:	1 byte
;   Outputs:	none
;******************************************************************************
PowerControl	
	call	PopByte
	movwf	temp
	btfss	temp,0
	call	VddOff		; turn Vdd off
	btfsc	temp,0
	call	VddOn		; turn Vdd on
	btfss	temp,1
	call	PWMOff		; turn 5kHz square wave off
	btfsc	temp,1
	call	PWMOn		; turn 5kHz square wave on
	return

;******************************************************************************
; Delay
;  Generic Delay function.  Uses a TMR0 to create 4ms delay.  
;******************************************************************************
Delay
	movlw	.162
	movwf	TMR0		; preload TMR0 so it overflows after 4ms
	bcf	INTCON,T0IF
DelayLoop
	btfss	INTCON,T0IF	; if TMR0 flag is set return, else loop
	goto	DelayLoop
	return

;******************************************************************************
; TxInit
;  Initialize transmit variables
;******************************************************************************
TxInit
	movlw	TxBuffer
	movwf	TxBufferPtr
	return

;******************************************************************************
; TxByte
;  Takes the Byte in Wreg and queues it up for the USB In.  When the buffer is 
;  full it sends it up the USB link via PutEP1.  If the put isn't successful, 
;  it waits until the buffer is free.
;   Inputs:	1 byte in w
;   Outputs:	none  
;******************************************************************************
TxByte
	movwf	temp		; save 1 stbyte
	movf	TxBufferPtr,w
	movwf	FSR
	movf	temp,w
	movwf	INDF
	incf	TxBufferPtr,f	; bump the pointer to the next position
	movf	TxBufferPtr,w
	xorlw	TxBuffer+8	; is the buffer full?
	btfss	STATUS,Z
	return			; no: return for the next byte

	movlw	TxBuffer	; initialize TxBufferPtr
	movwf	TxBufferPtr	
	movwf	FSR		; point to TxBuffer
TxLoop
	movlw	8
	pagesel PutEP1
	call	PutEP1		; send the buffer 
	pagesel TxLoop
	banksel TxBuffer
	btfss	STATUS,C	; was it successful?
	goto	TxLoop		; no, try again.
	return			

;******************************************************************************
; SendCommand
;  Sends a 6 bit command to the host.  
;   Inputs:	1 byte in w
;   Outputs:	none
;******************************************************************************
SendCommand
	movwf	Command		; store command
	movlw	.6		; preload loop counter to 6
	movwf	LoopCnt		
	bcf	INTCON, GIE 	; disable global interrupts

CommandLoop
	bcf	PORTC,6		; pull clock pin low
	bsf	TempPORTC,7	; preset bit for clock pin in PORTC temp reg.
	rrf	Command,f	; rotate command bit into PORTC temp register
	rrf	TempPORTC,w	
	movwf	PORTC		; copy PORTC temp register to PORTC
	decfsz	LoopCnt,f	; if done 6 times then command is sent and exit
	goto	CommandLoop

EndCommandLoop
	bcf	PORTC,6		; clear clock pin
	bsf	INTCON,GIE	; re-enable global interrupts
	return

;******************************************************************************
; Write14
;  Write 14 bits to program memory or data memory  
;   Inputs:	2 bytes 
;		(1 byte in w)
;		(1 byte pointed to by FSR)
;   Outputs:	none
;******************************************************************************
Write14
	movwf	TempWord	; move LSB to tempory register
	movf	INDF,w
	movwf	TempWord+1	; move MSB to subsequent tempory register
	movlw	.14		; load loop counter with 14
	movwf	LoopCnt
	bcf	INTCON, GIE	; disable interrupts
	bsf	PORTC,6		; set clock pin high
	nop
	
WriteLoop
	bcf	PORTC,6		; drop clock pin low
	bsf	TempPORTC,7	; preset bit for clock high in PORTC temp reg.
	rrf	TempWord+1,f	; rotate next data bit into PORTC temp register
	rrf	TempWord,f
	rrf	TempPORTC,w	
	movwf	PORTC		; copy PORTC temp register to PORTC
	decfsz	LoopCnt,f	; if 14th time then exit
	goto	WriteLoop
EndWriteLoop
	bcf	PORTC,6		; toggle clock pin
	movlw	b'01000000'	; clear data pin
	movwf	PORTC
	nop
	clrf	PORTC		; clear clock pin
	bsf	INTCON, GIE	; enable interrupts
	return

;******************************************************************************
; Read14
;  Read program memory or data memory  
;   Inputs:	none
;   Outputs:	2 bytes 
;		(1 byte in w)
;		(1 byte pointed to by FSR)
;******************************************************************************
Read14
	bcf	INTCON,GIE	; disable interrupts
	banksel	TRISC
	bsf	TRISC,7		; put data pin in tri-state mode
	banksel	LoopCnt
	movlw	.14		; load loop counter with 14
	movwf	LoopCnt
	clrf	TempWord	; clear storage word for memory
	clrf	TempWord+1
	bsf	PORTC,6		; toggle clock pin
	nop
	bcf	PORTC,6
	nop

ReadLoop	
	bsf	PORTC,6		; set clock pin
	rlf	PORTC,w		; rotate data pin state into storage word
	rrf	TempWord+1,f
	rrf	TempWord,f
	bcf	PORTC,6		; clear clock pin
	decfsz	LoopCnt,f	; if 14th time then exit
	goto	ReadLoop

EndReadLoop
	bsf	PORTC,6		; set clock pin
	bsf	STATUS,RP0	; Bank1
	bcf	TRISC,7		; make data pin an output again
	bcf	STATUS,RP0	; Bank0
	clrf	PORTC		; clear clock and data pins
	bsf	INTCON,GIE	; re-enable interrupts
	bcf	STATUS,C	; shift storage word right two bits
	rrf	TempWord+1,f
	rrf	TempWord,f
	rrf	TempWord+1,f
	rrf	TempWord,f
	movlw	TempWord+1	; move LSB of read data into w
	movwf	FSR	
	movf	TempWord,w	; move MSB of read data into INDF
	return

;******************************************************************************
; PopInit
;  Initialize receive registers.  
;******************************************************************************
PopInit
	movlw	RcvBuffer
	movwf	RcvBufferPtr
	return

;******************************************************************************
; PopByte
;  Pop one byte out of USB receive buffer.
;   Inputs:	none
;   Outputs:	1 byte in w 
;		carry flag (1 = success, 0 = unsuccessful)
;******************************************************************************
PopByte
	movf	FSR,w		; save FSR register
	movwf	FSRSave
	
	movf	RcvBufferPtr,w	; is the receive buffer pointer no
	xorlw	RcvBuffer+9	;  longer pointing to the buffer?
	btfsc	STATUS,Z
	goto	QueueEmpty	; yes, go do something else...
	
	movf	RcvBufferPtr,w	; no, then get the next command or parameter
	movwf	FSR
	movf	INDF,w	
	movwf	temp
	incf	RcvBufferPtr,f  ; increment the buffer pointer
	bsf	STATUS,C	; set carry to signal successful
	goto	PopByteDone
	
QueueEmpty
	movlw	RcvBuffer	; initialize receive buffer pointer
	movwf	RcvBufferPtr
	bcf	STATUS,C	; clear carry to signal unsuccessful
PopByteDone
	movf	FSRSave,w	; restore FSR register
	movwf	FSR
	movf	temp,w		; move command or parameter to w and exit
	return
	
	end

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品久久久蜜桃| 国产成人精品免费一区二区| 久国产精品韩国三级视频| 91在线视频在线| 精品91自产拍在线观看一区| 亚洲精品乱码久久久久久| 国产成人综合网站| 日韩欧美在线一区二区三区| 一区二区成人在线观看| 国产 欧美在线| 欧美mv日韩mv国产网站| 亚洲一区二区三区美女| 国产mv日韩mv欧美| 久久综合视频网| 麻豆国产一区二区| 欧美一区二区三区男人的天堂| 中文字幕一区二区三区在线播放 | 国产日韩欧美精品一区| 视频一区中文字幕国产| 色综合久久中文综合久久牛| 久久精品一区二区三区不卡牛牛| 日本人妖一区二区| 欧美美女一区二区在线观看| 亚洲午夜电影网| 91豆麻精品91久久久久久| 中文字幕一区二区三区色视频 | 久久久精品人体av艺术| 日韩成人dvd| 91精品国产高清一区二区三区| 亚洲在线视频一区| 欧美日韩一区国产| 亚洲福中文字幕伊人影院| 欧美三级日本三级少妇99| 亚洲国产中文字幕| 在线精品视频免费观看| 五月天一区二区| 欧美美女网站色| 日韩电影在线观看网站| 日韩一区二区在线观看视频| 精品影视av免费| 久久久久久久久久久久电影| 成人自拍视频在线观看| 欧美激情一区二区| 91麻豆免费视频| 亚洲午夜影视影院在线观看| 日韩一区二区三区在线视频| 久久国产夜色精品鲁鲁99| 精品日韩在线观看| 大白屁股一区二区视频| 亚洲免费av观看| 337p亚洲精品色噜噜| 久久成人免费网| 国产精品免费视频一区| 在线观看区一区二| 免费高清不卡av| 中文字幕av不卡| 欧美日韩午夜影院| 韩国精品一区二区| 伊人色综合久久天天| 日韩免费高清av| 91麻豆精品国产91久久久使用方法 | 国产激情视频一区二区三区欧美| 亚洲欧美自拍偷拍| 9191久久久久久久久久久| 国产做a爰片久久毛片 | 久久综合丝袜日本网| youjizz久久| 舔着乳尖日韩一区| 国产精品网站在线观看| 欧洲精品视频在线观看| 久久成人麻豆午夜电影| 亚洲男人的天堂一区二区| 91精品蜜臀在线一区尤物| www.在线欧美| 激情久久五月天| 亚洲一区二区欧美激情| 国产丝袜在线精品| 欧美日韩aaa| 99久久久国产精品免费蜜臀| 免费一级欧美片在线观看| 亚洲欧美另类图片小说| 精品国内二区三区| 欧美日韩在线电影| 成人app下载| 久久99国产精品免费网站| **性色生活片久久毛片| 久久这里只精品最新地址| 欧美四级电影网| 99久久国产综合精品色伊| 麻豆91免费观看| 亚洲国产aⅴ天堂久久| 国产精品免费aⅴ片在线观看| 日韩欧美卡一卡二| 欧美日韩你懂得| 91麻豆国产在线观看| 国产成人自拍高清视频在线免费播放| 午夜天堂影视香蕉久久| 亚洲黄色小视频| 中文字幕中文乱码欧美一区二区| 欧美zozo另类异族| 欧美日韩第一区日日骚| 91欧美激情一区二区三区成人| 国产麻豆午夜三级精品| 六月丁香婷婷色狠狠久久| 日产欧产美韩系列久久99| 夜色激情一区二区| 亚洲精品免费一二三区| 亚洲婷婷综合色高清在线| 国产日韩欧美一区二区三区综合| 精品国产一区二区三区忘忧草| 6080国产精品一区二区| 欧美日韩一区高清| 欧美绝品在线观看成人午夜影视| 在线视频综合导航| 在线看国产一区二区| 日本高清成人免费播放| 在线看一区二区| 欧美日韩高清一区二区三区| 欧美精品丝袜久久久中文字幕| 精品视频1区2区3区| 4438x亚洲最大成人网| 日韩欧美第一区| 久久综合久久久久88| 久久久久一区二区三区四区| 2017欧美狠狠色| 中文字幕av一区二区三区高 | 波多野结衣一区二区三区 | 激情综合色播激情啊| 激情国产一区二区| 国产精品一区不卡| 成人丝袜18视频在线观看| caoporn国产精品| 欧美日韩视频一区二区| 日韩一区二区三区三四区视频在线观看| 91精品婷婷国产综合久久竹菊| 日韩精品一区二区三区中文精品| 久久夜色精品国产噜噜av| 国产精品免费观看视频| 亚洲一区二区黄色| 久久99国产精品麻豆| 国产99精品视频| 在线观看av一区| 欧美成人欧美edvon| 中文字幕一区二区三区在线播放 | 欧美一区在线视频| 久久亚洲精精品中文字幕早川悠里 | 不卡一二三区首页| 欧美三级韩国三级日本一级| 欧美精品一区二区三区在线播放| 中文字幕欧美日本乱码一线二线| 一区二区三区高清不卡| 国产一区二区三区综合| 欧美视频自拍偷拍| 国产欧美综合色| 午夜精彩视频在线观看不卡| 国产精品一区二区在线看| 欧美综合视频在线观看| 久久久www免费人成精品| 亚洲主播在线播放| 国产 欧美在线| 日韩欧美中文字幕公布| 亚洲福利视频一区| 不卡av在线免费观看| 欧美tickling网站挠脚心| 国产精品短视频| 国产麻豆精品在线观看| 91精品在线观看入口| 亚洲免费观看在线视频| 国产高清在线精品| 日韩欧美国产不卡| 一区二区三区 在线观看视频| 国产一区二区三区在线观看免费视频| 色综合视频一区二区三区高清| 久久久91精品国产一区二区三区| 亚洲综合精品自拍| 成人综合婷婷国产精品久久免费| 日韩免费一区二区三区在线播放| 一区二区三区不卡在线观看| 不卡视频一二三四| 国产午夜精品在线观看| 激情都市一区二区| 日韩精品一区二| 首页国产丝袜综合| 欧美色视频一区| 亚洲人123区| hitomi一区二区三区精品| 国产亚洲短视频| 国产成人av一区二区三区在线观看| 日韩精品一区二区三区四区| 日韩不卡手机在线v区| 欧美色图免费看| 亚洲高清免费视频| 欧美绝品在线观看成人午夜影视| 亚洲午夜激情网页| 欧美日韩精品综合在线| 亚洲自拍与偷拍| 欧美日韩国产成人在线免费| 爽好久久久欧美精品| 欧美一区二区在线不卡| 日韩国产成人精品|