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

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

?? pickit.asm

?? pic16c745 的 firmware的一個usb樣例,供大家參考
?? ASM
?? 第 1 頁 / 共 2 頁
字號:
;******************************************************************************
;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.       
;******************************************************************************
;******************************************************************************
;Filename:	PICkit.asm
;Author:	Reston Condit
;Date:		23 January 2003  	
;Version:	1.00
;Description:  	
;  This firmware is written for the PICkit(TM) 1 FLASH Starter Kit. 
;
;******************************************************************************
;Revision History:
;  none
;******************************************************************************
;Include files:

#include <p16c745.inc>
#include "usb_defs.inc"
#include "VppCntrl.inc"
#include "pid.inc"

;******************************************************************************

	errorlevel  -302	; suppress message 302 from list file

	__CONFIG  _H4_OSC & _WDT_OFF & _PWRTE_OFF & _CP_OFF

unbanked	udata_shr
W_save		res	1	; register for saving W during ISR

bank0	udata
Status_save	res	1	; registers for saving context 
PCLATH_save	res	1	;  during ISR
FSR_save	res	1
FSRSave		res	1
PIRmasked	res	1
USBMaskedInterrupts  res  1
Command		res	1
counter		res	2
LoopCnt		res	1
TempPORTC	res	1
AWord		res	2
RcvBuffer	res	8
RcvBufferPtr	res	1
TxBuffer	res	8
TxBufferPtr	res	1
temp		res	1
CheckSum	res	3
TempWord	res	2
ProgramCntr	res	2

	extern	InitUSB
	extern	PutEP1
	extern	GetEP1
	extern	RemoteWakeup
	extern	USBReset
	extern	USBActivity
	extern	USBStall
	extern	USBError
	extern	USBSleep
	extern	TokenDone
	extern	USB_dev_req
	extern	finish_set_address

STARTUP	code
	pagesel	Main
	goto	Main
	nop
	
;******************************************************************************
; Interrupt Service Routine
;******************************************************************************
InterruptServiceVector
	movwf	W_save		; save W
	movf	STATUS,W
	clrf	STATUS		; force to page 0
	movwf	Status_save	; save STATUS
	movf	PCLATH,w
	movwf	PCLATH_save	; save PCLATH
	movf	FSR,w
	movwf	FSR_save	; save FSR

PERIPHERALTEST
	btfss	INTCON,PEIE	; is there a peripheral interrupt?
	goto	EndISR		; all done....

TEST_PIR1
	bsf 	STATUS, RP0	; Bank1
	movf	PIE1,w
	bcf	STATUS, RP0	; Bank0
	andwf	PIR1,w		; mask the enables with the flags
	movwf	PIRmasked

	pagesel TryADIF
	btfss	PIRmasked,USBIF	; USB interrupt flag
	goto	TryADIF
	bcf	PIR1,USBIF
	
	banksel UIR
	movf	UIR,w
	andwf	UIE,w
	banksel USBMaskedInterrupts
	movwf	USBMaskedInterrupts

	pagesel	USBActivity
	btfsc	USBMaskedInterrupts,ACTIVITY	; Is there activity on the bus?
	call	USBActivity

	pagesel	USBReset
	btfsc	USBMaskedInterrupts,USB_RST	; is it a reset?
	call	USBReset	; yes, reset the SIE

	pagesel TryADIF
	btfss	USBMaskedInterrupts,TOK_DNE	; is it a Token Done?
	goto	TryADIF		; no, skip the queueing process

CheckFinishSetAddr
	banksel UIR
	bcf	UIR, TOK_DNE	; clear Token Done
	bcf	STATUS,RP0	; bank 2
	movf	USB_dev_req,w	; Are we waiting for the In transaction 
	xorlw	SET_ADDRESS	;  ack-ing the end of the set address?
	btfss	STATUS,Z
	goto	TryADIF		; no, skip the rest.. just queue the USTAT 
				;  register
	pagesel finish_set_address ; yes, finish setting the address
	call	finish_set_address
	clrf	STATUS		; bank 0

TryADIF

;	btfsc   PIRmasked,ADIF		; AD Done?
;	nop
;	btfsc	PIRmasked,RCIF
;	nop
;	btfsc	PIRmasked,TXIF
;	nop
;	btfsc	PIRmasked,CCP1IF
;	nop
	pagesel	DoSwitcher
	banksel	PIRmasked
	btfss	PIRmasked,TMR2IF
	goto	TEST_PIR2
	movf	PORTC,w		; toggle RC1
	xorlw	0x02
	movwf	PORTC
	call	DoSwitcher
;	btfsc	PIRmasked,TMR1IF
;	nop
TEST_PIR2
;	banksel	PIR2
;	movf	PIR2,w
;	banksel	PIE2
;	andwf	PIE2,w
;	banksel	PIRmasked
;	movwf	PIRmasked
;	btfsc	PIRmasked,CCP2IF
;	nop

;******************************************************************************
; End ISR, restore context and return to the Main program
;******************************************************************************
EndISR
	clrf	STATUS		; select bank 0
	movf	FSR_save,w	; restore the FSR
	movwf	FSR
	movf	PCLATH_save,w	; restore PCLATH
	movwf	PCLATH
	movf	Status_save,w	; restore Status
	movwf	STATUS
	swapf	W_save,f	; restore W without corrupting STATUS
	swapf	W_save,w
	retfie

PORT1	code

;******************************************************************************
; ServiceUSB
;    Services any outstanding USB interrupts.
;    This should be called from the main loop.
;******************************************************************************
ServiceUSB
	banksel	UIR
	movf	UIR,w		; move UIR to bank0 variable
	banksel	USBMaskedInterrupts
	movwf	USBMaskedInterrupts

	pagesel	USBError	; service USB error flags
	btfsc	USBMaskedInterrupts,UERR
	call	USBError

	pagesel	USBSleep	; service USB IDLE flag
	btfsc	USBMaskedInterrupts,UIDLE
	call	USBSleep

	pagesel	USBStall	; service USB stall flag
	btfsc	USBMaskedInterrupts,STALL
	call	USBStall

	pagesel	TokenDone	; service TOKEN Done interrupts
	btfsc	USBMaskedInterrupts,TOK_DNE
	call	TokenDone

	pagesel	ServiceUSB	; page0
	clrf	STATUS		; bank0
	return

;******************************************************************************
; Main
;  Initializes registers then waits for USB communication.  
;     
;******************************************************************************
Main
	movlw	.30		; delay 16 uS to wait for USB to reset
	movwf	W_save		; SIE before initializing registers
	decfsz	W_save,f	; W_save is merely a convienient register
	goto	$-1		; to use for the delay counter.

	banksel	TRISA		; Bank 1
	clrf	TRISA		; Set PORTA as all outputs
	clrf	TRISB		; Set PORTB as all outputs
	movlw	0xC2		
	movwf	TRISC		; Outputs:RC0,RC2-RC5 Inputs:RC1,RC6,RC7
	movlw	0x07
	movwf	OPTION_REG	; TMR0 Prescaler: 1:256 Overflows at 10.9mS
	banksel PORTA
	clrf	PORTA		; Clear all ports
	clrf	PORTB
	clrf	PORTC

	pagesel	InitUSB		
	call	InitUSB		; Initialize USB communication.
	 
	pagesel	VppInit
	call	VppInit		; Initiate Vpp PWM
	call	VppOff		; Turn Vpp off
	call	VppHigh		; Set Vpp to 13v (when it's turned on)
	call	VddOn		; Turn Vdd on
	call	PopInit		; Initialize Popbyte variables
	call	TxInit		; Initialize transmit variables

MainLoop
	call	ServiceUSB	; see if there are any USB tokens to process

	ConfiguredUSB		; macro to check configuration status
	btfss	STATUS,Z	; Z = 1 when configured
	goto	MainLoop

	bankisel RcvBuffer		
	banksel	RcvBuffer	; move the address for 'Buffer' into
	movlw	RcvBuffer	;  the FSR pointer
	movwf	FSR
	movlw	8		; look for eight bytes
	pagesel	GetEP1
	call	GetEP1		; see if there are any commands to process
	pagesel	MainLoop
	btfss	STATUS,C	
	goto	MainLoop	; continue with main loop

MainLoopCont
	call	PopByte		; get the next command on the queue
	movwf	Command
	btfss	STATUS,C
	goto	MainLoop	; nothing there

	call	ServiceUSB	; see if there are any USB tokens to process
	call	Dispatch
	goto	MainLoopCont
	
;******************************************************************************
;#defines    
;******************************************************************************
; ASCII commands from sent by GUI
#define	ENTERPROGRAM	A'P'	; Enter programming mode
#define	EXITPROGRAM	A'p'	; Exit programming mode
#define WRITEPGM	A'W'	; Write program memory
#define WRITECONFIG	A'C'	; Set Program Counter to 0x2000 (Config Mem)
#define	WRITEDATA	A'D'	; Write data memory
#define	ERASEPGM	A'E'	; Bulk erase program memory 
#define	ERASEDATA	A'e'	; Bulk erase data memory
#define	INCADDRESS	A'I'	; Increment address
#define	READPGM		A'R'	; Read program memory
#define	READDATA	A'r'	; Read data memory
#define	CHECKSUM	A'S'	; Calculate checksum
#define	GETVERSION	A'v'	; Get firmware version number
#define	STUFFBYTE	A'Z'	; Stuff byte
#define	POWERCTRL	A'V'	; Turn Vdd on/off; Turn 5kHz square wave on/off

; Command Mapping from the PIC12F629/675 programming specification
#define	LOADCONFIG		B'00000000'
#define	LOADPGM			B'00000010'
#define LOADDATA		B'00000011'
#define READPGMMEM		B'00000100'
#define READDATAMEM		B'00000101'
#define	INCRADDRESS		B'00000110'
#define	BEGINPROGRAMMING	B'00001000'
#define	BULKERASEPGM		B'00001001'
#define	BULKERASEDATA		B'00001011'

; Firmware version revision
#define  MAJORVERSION	0x00
#define  MINORVERSION	0x09
#define  DOTVERSION	0x00

;******************************************************************************
; Dispatch
;  Interprets the command and calls the appropriate function to execute the 
;  command.     
;******************************************************************************
Dispatch
	movf	Command,w		
	xorlw	ENTERPROGRAM
	btfsc	STATUS,Z
	goto	EnterProgramMode

	movf	Command,w
	xorlw	EXITPROGRAM
	btfsc	STATUS,Z
	goto	ExitProgramMode

	movf	Command,w
	xorlw	ERASEPGM
	btfsc	STATUS,Z
	goto	EraseProgram

	movf	Command,w
	xorlw	ERASEDATA
	btfsc	STATUS,Z
	goto	EraseEEData
	
	movf	Command,w
	xorlw	WRITEPGM
	btfsc	STATUS,Z
	goto	WriteProgram

	movf	Command,w
	xorlw	WRITEDATA
	btfsc	STATUS,Z
	goto	WriteEEData

	movf	Command,w
	xorlw	WRITECONFIG
	btfsc	STATUS,Z
	goto	WriteConfig
	
	movf	Command,w
	xorlw	INCADDRESS
	btfsc	STATUS,Z
	goto	IncrementPCmulti

	movf	Command,w
	xorlw	READPGM
	btfsc	STATUS,Z
	goto	ReadProgram
	
	movf	Command,w
	xorlw	READDATA
	btfsc	STATUS,Z
	goto	ReadEEData
	
	movf	Command,w
	xorlw	CHECKSUM
	btfsc	STATUS,Z
	goto	CalcChecksum

	movf	Command,w
	xorlw	GETVERSION
	btfsc	STATUS,Z
	goto	ReportVersion
	
	movf	Command,w
	xorlw	POWERCTRL
	btfsc	STATUS,Z
	goto	PowerControl
	
	return		; command not recognized, ignore it.

;******************************************************************************
; EnterProgramMode
;  Issues Enter Program Mode command to PIC12F629/675. Clears ProgramCntr.
;   Inputs:	none
;   Outputs:	none
;******************************************************************************
EnterProgramMode
	bsf	STATUS,RP0
	movlw	0x02		
	movwf	TRISC		; RC1 is input; RC0,RC2-RC7 are outputs
	bcf	STATUS,RP0
	movlw	.85		; Clear ProgramCntr (see later in function)
	movwf	ProgramCntr
	clrf	ProgramCntr+1
	movlw	0x3F		; force clock and data pin low
	andwf	PORTC,f
	call	Delay		; 4 ms delay
	call	Delay 
	call	VppOn		; turn on Vpp
	decfsz	ProgramCntr	; wait 85x3 instructions (~40us)
	goto	$-1		; ProgramCntr is clear upon leaving function
	call	VddOn		; turn on Vdd
	return

;******************************************************************************
; EnterProgramMode
;  Issues Exit Program Mode command to PIC12F629/675.
;   Inputs:	none
;   Outputs:	none
;******************************************************************************
ExitProgramMode
	bsf	STATUS,RP0
	movlw	0xC2		
	movwf	TRISC		; outputs:RC0,RC2-RC5 inputs:RC1,RC6,RC7
	bcf	STATUS,RP0
	call	VddOff		; turn off Vdd
	call	VppOff		; Turn off Vpp
	return

;******************************************************************************
; EraseProgram
;  Issues Bulk Erase Program Memory command.
;   Inputs:	none
;   Outputs:	none
;******************************************************************************
EraseProgram
	movlw	BULKERASEPGM
	call	SendCommand
	call	Delay
	call	Delay
	return

;******************************************************************************
; EraseEEData
;  Issues Bulk Erase Data Memory command.
;   Inputs:	none
;   Outputs:	none
;******************************************************************************
EraseEEData
	movlw	BULKERASEDATA
	call	SendCommand
	call	Delay
	call	Delay
	return

;******************************************************************************
; WriteConfig
;  Issues Write Configuration command. IT DOES NOT PROGRAM THE CONFIGURATION 
;  MEMORY.  Send Write Program Memory command to do that.  ProgramCNTR is set
;  to 0x2000.
;   Inputs:	2 bytes (both are ingored)
;   Outputs:	none
;******************************************************************************
WriteConfig
	clrf	ProgramCntr
	movlw	0x20
	movwf	ProgramCntr+1
	movlw	LOADCONFIG	; Load Data for Configuration memory
	call	SendCommand	;  send the Write Command to the device
	clrf	AWord		; Use Load Config Data to change modes 	
	clrf	AWord+1		;  not to actually program Config memory.
	movlw	AWord+1		;  Use Load Program Data to program config
	movwf	FSR		;  memory.
	movf	AWord,w
	call	Write14	
	return		

;******************************************************************************
; WriteProgram
;  Issues Write Program Memory command.  Pops a word out of the endpoint buffer
;  to write. 
;   Inputs:	1 word program memory
;   Outputs:	none
;******************************************************************************
WriteProgram
	movlw	LOADPGM		; Load Data for Program memory
	call	SendCommand	; send the Write Command to the device
	call	PopByte		; Pop low order byte, move to AWord
	movwf	AWord
	call	PopByte		; Pop high order byte, move to AWord+1
	movwf	AWord+1
	movlw	AWord+1
	movwf	FSR
	movf	AWord,w
	call	Write14		; send word to device
	
	call	BeginProgramCycle ; wait just the 4ms in BeginProgramCycle
	call	IncrementPC	; increment PC to prepare for next write
	return

;******************************************************************************
; WriteEEData
;  Issues Write Data Memory command.  Pops a byte out of the endpoint buffer to
;  write.
;   Inputs:	1 byte data memory
;   Outputs:	none
;******************************************************************************
WriteEEData
	movlw	LOADDATA	; Load Data for EE memory
	call	SendCommand	; send the Write Command to the device

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一二三四区| 91免费在线视频观看| 欧美日韩国产经典色站一区二区三区 | 中文字幕精品一区二区精品绿巨人 | 国产精品免费免费| 国产suv一区二区三区88区| 欧美成人伊人久久综合网| 亚洲老司机在线| 在线观看亚洲精品视频| 国产婷婷一区二区| 国产一区二区福利视频| 91精品国产综合久久精品麻豆 | 人人精品人人爱| 91精品国产欧美日韩| 男女性色大片免费观看一区二区| 6080国产精品一区二区| 美脚の诱脚舐め脚责91| 337p粉嫩大胆噜噜噜噜噜91av| 国内久久婷婷综合| 国产亚洲欧美在线| 色综合久久天天| 亚洲超丰满肉感bbw| 欧美一级精品大片| 国产精品一区二区黑丝| 日本一区二区三区国色天香 | 91精品国产综合久久久久久久| 麻豆精品视频在线观看| 久久综合九色综合欧美亚洲| 成人午夜又粗又硬又大| 亚洲免费观看高清| 在线成人免费视频| 寂寞少妇一区二区三区| 欧美国产丝袜视频| 在线视频一区二区三| 奇米色一区二区| 亚洲国产你懂的| 国产一区二区在线免费观看| 欧美tickling网站挠脚心| 国产成人在线网站| 国产欧美一区二区精品久导航| a亚洲天堂av| 午夜在线成人av| 久久日一线二线三线suv| 成人app网站| 日韩av网站在线观看| 日韩欧美国产1| 色婷婷综合久久久中文字幕| 日韩av中文在线观看| 国产精品天天摸av网| 欧美日韩高清影院| 国产99久久久国产精品| 亚洲一区在线观看视频| 亚洲精品一区二区精华| 色哟哟精品一区| 亚洲成人中文在线| 国产日韩欧美在线一区| 欧美日韩一区二区三区高清| 粉嫩av亚洲一区二区图片| 亚洲成av人片一区二区| 国产精品伦一区二区三级视频| 欧美顶级少妇做爰| 91国产视频在线观看| 国产激情视频一区二区三区欧美 | 国产欧美一区二区在线| 91精品婷婷国产综合久久性色 | 夜夜精品视频一区二区| 国产午夜精品在线观看| 日韩一区二区麻豆国产| 色视频成人在线观看免| av午夜精品一区二区三区| 国产毛片精品视频| 免费成人在线观看视频| 亚洲一二三级电影| 亚洲精品乱码久久久久久日本蜜臀| 久久一留热品黄| 精品免费日韩av| 91精品国产91久久久久久一区二区 | 国产成人在线网站| 极品少妇xxxx精品少妇| 日本强好片久久久久久aaa| 亚洲一区二区三区自拍| 日韩一区在线免费观看| 欧美高清一级片在线观看| 久久只精品国产| 欧美va亚洲va香蕉在线| 91精品国产综合久久精品| 欧美精品一二三区| 欧美日韩你懂的| 7878成人国产在线观看| 色综合天天综合在线视频| 国产精品亚洲成人| 国产美女一区二区三区| 久久97超碰色| 美女视频一区在线观看| 日韩综合在线视频| 国产精品欧美精品| 中文字幕av一区二区三区高| 国产亚洲美州欧州综合国| 在线观看视频91| 欧美日韩激情一区| 日韩一区二区精品在线观看| 日韩一级完整毛片| 久久久久久电影| 久久精品免视看| 国产精品美女www爽爽爽| 中文字幕一区在线观看视频| 亚洲色图制服诱惑| 一二三四社区欧美黄| 日韩福利电影在线观看| 韩国一区二区三区| 成人黄色777网| 欧美主播一区二区三区| 欧美一区二区成人| 国产午夜精品理论片a级大结局| 中文字幕精品一区| 亚洲午夜电影在线| 激情综合一区二区三区| jvid福利写真一区二区三区| 欧美中文字幕不卡| 日韩欧美在线网站| 亚洲欧美综合在线精品| 五月开心婷婷久久| 国产乱对白刺激视频不卡| 99热99精品| 日韩一级免费一区| 中文字幕一区二区三区色视频| 亚洲国产日韩一区二区| 精品一二三四区| 91在线观看下载| 欧美一区二区网站| 国产精品二三区| 日韩va欧美va亚洲va久久| 国产成人aaaa| 欧美三电影在线| 中文一区二区在线观看| 亚洲成人动漫在线免费观看| 国产做a爰片久久毛片| 91亚洲永久精品| 精品久久久久一区二区国产| 亚洲视频在线一区| 久久爱www久久做| 日本久久一区二区| 久久久一区二区三区| 亚洲视频免费在线观看| 蜜桃91丨九色丨蝌蚪91桃色| 99久久精品国产网站| 日韩欧美一级片| 国产精品成人免费精品自在线观看 | 色婷婷综合久久久久中文一区二区 | 91久久精品午夜一区二区| www.成人在线| 色综合久久综合| 久久久99久久精品欧美| 午夜精品一区二区三区免费视频| bt7086福利一区国产| 精品久久久网站| 日韩高清国产一区在线| 欧美视频一区二区在线观看| 国产精品二三区| 国产毛片一区二区| 欧美一区二区三区视频| 亚洲精品五月天| 成人av先锋影音| 国产午夜精品久久久久久久| 另类小说视频一区二区| 欧美日韩国产综合视频在线观看 | 在线不卡免费av| 一区二区三区免费观看| aaa亚洲精品| 国产精品久久久久久久久果冻传媒 | 亚洲欧洲美洲综合色网| 风间由美中文字幕在线看视频国产欧美| 欧美美女视频在线观看| 亚洲男同1069视频| a亚洲天堂av| 国产精品久久久久久户外露出| 国产乱理伦片在线观看夜一区| 精品国产伦一区二区三区免费 | 日韩电影免费在线看| 欧美日韩久久不卡| 午夜a成v人精品| 欧美日韩和欧美的一区二区| 亚洲国产精品视频| 欧美曰成人黄网| 一区二区三区四区五区视频在线观看 | 欧美日韩电影在线播放| 青青青爽久久午夜综合久久午夜| 精品久久久久香蕉网| 国产成人av福利| 亚洲精品美腿丝袜| 欧美一区二区三区日韩视频| 国产真实乱子伦精品视频| 中文字幕成人在线观看| 在线一区二区视频| 日韩激情在线观看| 久久蜜桃av一区二区天堂| 91视频一区二区三区| 五月天一区二区| 日本一区二区三区四区在线视频 | av中文字幕一区|