亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美亚洲愉拍一区二区| 奇米亚洲午夜久久精品| wwwwxxxxx欧美| 欧美一区二区视频网站| 国产精品2024| 激情综合色综合久久综合| 午夜精品视频一区| 亚洲精品乱码久久久久久| 91精品国产一区二区| 欧美美女黄视频| 欧美日韩中文字幕一区二区| 日韩免费在线观看| 日韩欧美第一区| 日韩欧美另类在线| 欧美精品一区二区三区视频| 欧美日韩国产系列| 日韩三级伦理片妻子的秘密按摩| 欧美久久一二区| 欧美一区永久视频免费观看| 日韩欧美黄色影院| 欧美一区二视频| 日韩美女主播在线视频一区二区三区| 欧美色图天堂网| 精品久久久影院| 欧美国产日韩在线观看| 一区二区三区精品| 亚洲高清免费在线| 久久99精品久久久久久国产越南 | 国产欧美综合色| 夜夜亚洲天天久久| 久久草av在线| 欧美三级韩国三级日本一级| 2021久久国产精品不只是精品| 在线播放日韩导航| 亚洲欧美综合网| 亚洲国产精品人人做人人爽| 精品亚洲免费视频| 欧美日韩国产欧美日美国产精品| 久久久久久久久久久黄色| 香蕉av福利精品导航| 成人午夜视频在线| 日韩精品一区二区三区中文精品| 国产精品黄色在线观看| 亚洲人成精品久久久久久| 成人午夜激情影院| 亚洲国产精品成人久久综合一区| 国产专区欧美精品| 亚洲国产精品传媒在线观看| 视频精品一区二区| 国产河南妇女毛片精品久久久| 在线播放欧美女士性生活| 亚洲狠狠爱一区二区三区| 国产精品自拍在线| 久久久噜噜噜久久中文字幕色伊伊| 一区二区三区美女| 在线一区二区三区做爰视频网站| 国产亚洲精品超碰| 国内国产精品久久| 久久久无码精品亚洲日韩按摩| 免费精品99久久国产综合精品| 欧美日韩久久一区| 亚洲va天堂va国产va久| 日韩一区二区中文字幕| 精品一区在线看| 久久亚洲免费视频| 色婷婷久久久久swag精品| 一二三四社区欧美黄| 欧美精品自拍偷拍动漫精品| 蓝色福利精品导航| 中文字幕欧美区| 波多野结衣在线aⅴ中文字幕不卡| 亚洲老妇xxxxxx| 日韩女优电影在线观看| 一本高清dvd不卡在线观看| 视频一区在线视频| 日韩伦理免费电影| 日韩美女主播在线视频一区二区三区| 国产传媒久久文化传媒| 久久草av在线| 亚洲欧美激情插 | 日韩精品一区在线观看| 丁香桃色午夜亚洲一区二区三区| 亚洲精品成人a在线观看| 精品国产自在久精品国产| 粉嫩绯色av一区二区在线观看 | 2014亚洲片线观看视频免费| 日本久久电影网| 成人动漫视频在线| 国产精品自产自拍| 黑人巨大精品欧美黑白配亚洲| 国产精品免费人成网站| 久久蜜桃av一区精品变态类天堂| 色欧美片视频在线观看| 91老师片黄在线观看| 99精品久久只有精品| av在线这里只有精品| 91色综合久久久久婷婷| 91国偷自产一区二区三区成为亚洲经典| 国产成人精品一区二区三区四区| 久久超碰97人人做人人爱| 亚洲成人中文在线| 日韩精品一区第一页| 久久99热狠狠色一区二区| 九九热在线视频观看这里只有精品| 日本一区中文字幕| 黄色小说综合网站| 风间由美一区二区三区在线观看 | 成人免费看视频| 色综合久久久久综合99| 欧美日韩美女一区二区| 日韩一级完整毛片| 国产欧美日韩精品一区| 亚洲欧美二区三区| 亚洲成人自拍网| 丁香一区二区三区| 欧美日韩综合一区| 26uuu亚洲| 三级欧美在线一区| 成人动漫一区二区在线| 欧美亚洲国产一卡| 精品午夜一区二区三区在线观看| 中文字幕一区二区三区蜜月| 亚洲图片欧美综合| 国产99精品国产| 日韩欧美色电影| 亚洲国产日韩综合久久精品| 国产激情偷乱视频一区二区三区| 91美女在线看| 亚洲国产精品99久久久久久久久| 久久影音资源网| 精品影视av免费| 日韩欧美国产高清| 日韩一区精品字幕| kk眼镜猥琐国模调教系列一区二区| 欧美大尺度电影在线| 午夜欧美电影在线观看| 欧美优质美女网站| 一级做a爱片久久| www.亚洲精品| 欧美乱妇20p| 中文字幕一区二区三区视频 | 欧美日本高清视频在线观看| 国产欧美一区二区精品性| 国产黄人亚洲片| 欧美高清在线精品一区| 国产成人精品1024| 久久一夜天堂av一区二区三区| 捆绑调教一区二区三区| xvideos.蜜桃一区二区| 国产成人亚洲综合色影视| 久久免费国产精品| 91香蕉视频在线| 亚洲一区av在线| 欧美日韩国产一区二区三区地区| 国产精品福利一区二区三区| 日本高清不卡视频| 日本女人一区二区三区| 国产午夜久久久久| 欧美挠脚心视频网站| 成人深夜在线观看| 麻豆成人av在线| 婷婷成人激情在线网| 18成人在线视频| 欧美国产欧美亚州国产日韩mv天天看完整| 欧洲中文字幕精品| 欧美精品第一页| 欧美无人高清视频在线观看| 国产美女主播视频一区| 亚洲二区在线视频| 亚洲国产精品尤物yw在线观看| 国产精品国产三级国产aⅴ无密码| 日韩你懂的在线播放| 日韩欧美国产综合一区 | 日本va欧美va精品| 午夜私人影院久久久久| 亚洲一区二区三区视频在线播放| 国产日产欧产精品推荐色| 久久久久国色av免费看影院| 精品国产精品一区二区夜夜嗨| 日韩欧美黄色影院| 久久亚洲欧美国产精品乐播| 亚洲精品一区二区三区影院| 久久久久久久免费视频了| 欧美韩国日本不卡| 亚洲一线二线三线视频| 偷拍一区二区三区四区| 久久成人免费网| 成人a区在线观看| 亚洲欧洲三级电影| 亚洲丶国产丶欧美一区二区三区| 亚洲成av人片一区二区梦乃| 麻豆高清免费国产一区| 成人小视频免费观看| 欧美日韩国产影片| 久久九九国产精品| 日韩精品91亚洲二区在线观看 | 日韩免费福利电影在线观看| 国产日韩高清在线| 日韩在线一区二区三区| 国产99精品在线观看|