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

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

?? counter.asm

?? 驅動程序開發基礎教程
?? ASM
?? 第 1 頁 / 共 3 頁
字號:
; Port Usage
;  P1.0 -
;    .1 -
;    .2 - Button (0=pushed) (input)
;    .3 - LED (0=on)        (output)
;
;*******************************************************************************

;//$PAGE
; Directives
FillROM 0

; Microprocessor definitions
include "63x0x.inc"

;*************************************************
; Data Segment (RAM)
;*************************************************

; Program Stack
gbSysProgramStack       :equ 00h    ; [00h-1Fh] Stack 0x20h
gbSysDataStack          :equ 50h    ; [50h-6Fh] Stack 0x70h
gbSysFIFO               :equ 70h    ; [70h-7Fh] EP0 and EP1 FIFO's

; Global Interrupt
gbSysInterruptMask      :equ 20h    ; Holds the current interrupt mask

; USB management data
gbUSBSendSequence       :equ 28h    ; Buffer send data 0/1 line
gbUSBSendBytes          :equ 29h    ; Buffer bytes left to send
gbUSBSendBuffer         :equ 2Ah    ; Offset into current buffer

gbSuspendCount          :equ 2Bh    ; # of msec bus has been IDLE

; Button management
gbButtonDebounce        :equ 2Ch    ; Debounce count down value
gbButtonClicks          :equ 2Dh    ; Button count value

Button_Pin              :equ 04h    ; Pin the switch is on, P12
LED_ON                  :equ 08h    ; P13 is used to indicate Enumeration

;//$PAGE
;*************************************************
; Code Segment (ROM)
;*************************************************

; Vector Table
org 00h
    jmp main                ; Reset of some type
    jmp SysUnUsed           ; 128us timer (not used)
    jmp SysTimer1024usEvent ; 1024us timer
    jmp USBEndPoint0Event   ; EP0
    jmp USBEndPoint1Event   ; EP1 (not used)
    jmp SysUnUsed           ; Reserved
    jmp SysGPIOEvent        ; Button
    jmp SysUnUsed           ; CExt (not used)

;*************************************************
; Unused event
; Do nothing, restore machine to prior state
;*************************************************
SysUnUsed: 
    push  a
    mov   a,[gbSysInterruptMask]
    ipret SysInterrupt

;//$PAGE
;*******************************************************************************
; main()
; @func Entry point after PowerOn, WatchDog timeout or WakeUp from sleeping.
; @comm Never returns
;*******************************************************************************
main:
    ; This portion of Main is only executed after a RESET (Power-On or USB)
    ; Setup data stack in high order RAM, just below EP0 FIFO
    ; It will grow down from here
    mov  a,70h      ; USBEndP0FIFO
    swap a,dsp

    ; Initialize both Ports high 
    mov  a,FFh
    iowr SysPort0   ; Port 0 Data reg
    iowr SysPort1   ; Port 1 Data reg 
                    ;   1 on P13 is needed to make sure enumerate LED is off
                    ;   1 on any port that needs to be an input
    ; Enable Pullups (0=enable)
    mov  a,0
    iowr SysPort0PullUp
    mov  a,Button_Pin
    iowr SysPort1PullUp     ; 1 on P12 is needed to make sure GPIO interrupt
                            ;   occurs on LOW to HIGH transistion. This
                            ;   disables it's pull up
               
    ; Enable or disable interrupts on appropriate pins
    mov  a,0
    iowr SysPort0IntEnable     ; All pins irq's are disabled on Port 0
    mov  a,Button_Pin              
    iowr SysPort1IntEnable     ; Enable P12, the button pin.
                               ; No interrupts will occur until the device
                               ;   is enumerated. Then GPIO's will be enabled and
                               ;   we will allow P12 to generate interrupts

    ; Initialize USB variables
    mov  a,0
    mov  [gbUSBSendSequence],a  ; Start with a 0

    ; Initialize Counter
    mov  a,0
    mov  [gbButtonClicks],a     ; Initial state of 0, no button pushed

    ; Initialize variables
    mov a,0
    mov [gbUSBSendBytes],a      ; No bytes to send in FIFO buffers
    mov [gbSuspendCount],a      ; Reset bus activity to 0
    mov [gbButtonDebounce],a    ; We are not debouncing

    ; Set interrupt mask
    mov  a,SysIntTimer1024us  | SysIntUSBEndP0 
    mov  [gbSysInterruptMask],a

    ;*********************************************
  MainLoop:
    ; Enable interrupts to current mask
    mov  a,[gbSysInterruptMask]
    iowr SysInterrupt

    ; Loop
    jmp  MainLoop

;********************************************************
; SysTimer1024usEvent()
; @func Timer interrupt event ocurring every 1.024 mSec
;       using 6Mhz crystal.
;********************************************************
SysTimer1024usEvent:

    ; Save accumulator
    push a

    ; Clear watchdog timer
    ; Clearing it here effectively disables the timer
    iowr SysWatchDog

    ; Keep track of length of any IDLE conditions (No bus activity)
    iord USBControl                    ; Read the USB Status and Control Reg
    and a,01h                          ; Check bit 0
    cmp a,0h
    jz Inc_Counter                     ; Hmm! No activity. Branch and keep track of it.
    iord USBControl                    ; Ah! There was activity, 
                                       ;  clear the bus activity bit
    and a,0feh
    iowr USBControl
    mov a,0                            ; Clear the suspend counter
    mov [gbSuspendCount],a
    jmp Suspend_End

  Inc_Counter:                         ; Monitor the IDLE count
    mov a,[gbSuspendCount]             ; Get # of mSec we have been IDLE
    inc a                              ; Increment the count
    mov [gbSuspendCount],a              
    cmp a,03h                          ; Has it been 3msec yet?
    jnz Suspend_End                    ; Not yet, branch
    mov a,0h                           ; Yes, clear the suspend counter
    mov [gbSuspendCount],a
    iord SysStatus
    or  a,08h                          ; Set the suspend bit to cause a suspend
    iowr SysStatus                     ; We will enter the suspend state during
                                       ;   the next instruction.   

  Suspend_End:
    ; Are we counting down a button debounce
    mov  a,0
    cmp  a,[gbButtonDebounce]
    jz   STimerNoDebounce       ; Not debouncing, branch

    ; Yes, we're debouncing. Let's see if we are timed out.
    dec  [gbButtonDebounce]
    mov  a,0
    cmp  a,[gbButtonDebounce]

    ; has debounce timed out?
    jnz  STimerNoDebounce        ; No, still debouncing, branch.

    ; The debounce timer has timed out
    ; check if the button pin is at a 1. If not, the button is either still
    ;    bouncing or still pushed
    iord SysPort1              ; check the port the button is on
    and  a,Button_Pin          ; check the pin
    jz   STimerNoDebounce      ; branch if it is not pushed

    ; Reset debounce since the button is not yet released or is bouncing
    mov  a,[gbButtonClicks]
    inc  a;
    mov  [gbButtonClicks],a
    mov  [USBEndP1FIFO_0],a

    iord USBEndP1TxConfig
    and  a,40h
    or   a,91h
    iowr USBEndP1TxConfig

    ; Debounce must be over
  STimerNoDebounce:
    ; Enable interrupts and return
    mov  a,[gbSysInterruptMask]
    ipret SysInterrupt

;//$PAGE
;********************************************************
; SysGPIOEvent()
; @func General purpose port event
; @comm Which pin?
;********************************************************
SysGPIOEvent:

    ; Save accumulator
    push a

    ; Reset debounce any time we are here
    mov  a,50
    mov  [gbButtonDebounce],a

  SysGPIOButtonDebouncing:
    ; Enable interrupts and return
    mov  a,[gbSysInterruptMask]
    ipret SysInterrupt

USBEndPoint1Event:

    ; Save accumulator
    push a

    iord USBEndP1TxConfig
    xor a,40h
    iowr USBEndP1TxConfig

    ; Enable interrupts and return
    mov  a,[gbSysInterruptMask]
    ipret SysInterrupt

;*******************************************************************************
;
;    This section of code responds to activity on End Point 0 and determines
;    what needs to be done.
;
;*******************************************************************************

;//$PAGE
;********************************************************
; USBEndPoint0Event()
; @func End Point zero USB event.
; @comm Default end point.
;********************************************************
USBEndPoint0Event:

    ; This code checks to see what type of packet was received 
    ;   (Setup, Out, or In) and jumps to the correct routine to decode the 
    ;   specifics. After the code to which the jump points is through, it jumps
    ;   back to USBEventEP0End.

    ; Save accumulator
    push a

    ; Is this a SETUP packet?
    iord USBEndP0RxStatus
    and  a,USBEndP0RxSetup      ; Check the setup bit
    jnz  USBEventEP0_SETUP      ; Yes it's a setup, branch

  USBEventEP0End:
    ; OK. We're done with the packet.
    ;   Let's enable interrupts and return
    mov  a,[gbSysInterruptMask]
    ipret SysInterrupt    ; done with EP0 irq service routine

  USBEventEP0Stall:
    ; Stall any subsequent IN's or OUT's until the
    ;       stall bit (bit 5) is cleard by an I/O write to
    ;       the  USB End Point 0 TX Configuration Register (0x10)
    ;       or any SETUP is received.
    iord USBEndP0TxConfig
    or   a,USBEndP0TxStall
    iowr USBEndP0TxConfig

    ; OK. We've set the stall condition for Endpoint 0.
    ;   Now let's complete the routine.
    jmp  USBEventEP0End

;*******************************************************************************
; 
;    We know we have received a Setup token. Now we need to parse it to
;    determine what command it is.
;
;*******************************************************************************

;//$PAGE
;*******************************************************************************
; USBEventEP0_SETUP()
; @func End point event SETUP packet handler.
; @devnote Runs in interrupt enabled context.
;********************************************************
USBEventEP0_SETUP:
    ; Well, we have a SETUP packet. Let's find out what to do.
    mov A,[gbSysInterruptMask]
    iowr SysInterrupt

    ; If we are here and are and we are processing a previous Setup, 
    ;  we need to abort the processing of the previous Setup
    mov  a,0    ; Clear any indication that we have bytes left to transfer
    mov [gbUSBSendBytes],a
 
    ; Clear EP0 RxReg (including the Setup flag)
    ; The Data toggle bit remains unchanged, however.
    mov  a,0
    iowr USBEndP0RxStatus

    ;*********************************************
    ; Setup Event
    ;*********************************************

    ; Check the request type and branch to the correct location to handle it.
    mov  a,[USBEndP0FIFO_0]

  USBEventEP0SetupTargetDeviceOUT:
    ; Target Device?
    cmp  a,USBRqstTargetDevice
    jz   USBEventEP0SetupIsSetAddress   ; Yes

  USBEventEP0SetupTargetInterfaceOUT:
    cmp  a,USBRqstTargetInterface
    jz   USBEventEP0Stall               ; Yes. Oops! We don't have an interface.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产女同性恋一区二区| 免费欧美高清视频| 蜜桃视频一区二区| 91亚洲国产成人精品一区二三| 欧美电影一区二区三区| 中文字幕精品综合| 老司机精品视频线观看86| 99r精品视频| 久久久久综合网| 日本亚洲一区二区| 色哟哟一区二区在线观看| 精品剧情在线观看| 日韩精品一区第一页| 一本大道久久a久久精二百| 国产午夜精品福利| 九色porny丨国产精品| 欧美日韩免费视频| 一区二区三区中文在线| 成人免费高清视频在线观看| 亚洲精品一区二区三区蜜桃下载 | 91精品国产综合久久精品图片| 亚洲日本va午夜在线影院| 国产成人欧美日韩在线电影| 精品欧美一区二区三区精品久久| 香蕉乱码成人久久天堂爱免费| 91亚洲国产成人精品一区二三| 中文字幕电影一区| 国产91精品露脸国语对白| 日韩视频中午一区| 久久精品72免费观看| 91精品国产91久久久久久最新毛片| 亚洲另类中文字| 色国产综合视频| 亚洲一级二级在线| 欧美日韩国产精品自在自线| 亚洲第一精品在线| 欧美日韩成人在线| 日本va欧美va瓶| 日韩精品中文字幕在线不卡尤物| 蜜臀久久99精品久久久久久9| 欧美一级欧美一级在线播放| 久久成人精品无人区| 精品国产a毛片| 国产麻豆9l精品三级站| 国产精品午夜免费| 91欧美一区二区| 亚洲一区视频在线观看视频| 欧美日韩国产一区| 久久精品999| 中文字幕高清不卡| 欧洲精品视频在线观看| 日韩激情一二三区| 久久午夜国产精品| 99久久精品国产一区| 亚洲一区电影777| 日韩一二三四区| 国产成人午夜精品影院观看视频 | 亚洲国产电影在线观看| 91麻豆国产自产在线观看| 亚洲国产aⅴ天堂久久| 日韩欧美一区二区免费| 韩国成人福利片在线播放| 免费观看在线色综合| 精品国产一区二区在线观看| 99视频国产精品| 日韩电影在线一区| 国产精品免费av| 欧美片网站yy| 成人激情电影免费在线观看| 一区二区三区在线看| 欧美成人一区二区三区在线观看| 成人精品国产福利| 日本中文字幕不卡| 亚洲欧美在线视频| 精品国产乱码久久久久久图片| 成人高清视频免费观看| 日韩在线卡一卡二| 中文字幕一区二区三区视频| 欧美一区午夜视频在线观看| 成人一区二区视频| 免费一区二区视频| 亚洲卡通动漫在线| 久久久久国产免费免费| 这里是久久伊人| 色婷婷国产精品| 国产夫妻精品视频| 免费观看30秒视频久久| 一区二区高清免费观看影视大全| 久久综合九色综合欧美亚洲| 欧美少妇性性性| 91丨九色丨蝌蚪丨老版| 国产成人日日夜夜| 国产在线播放一区三区四| 午夜av电影一区| 亚洲一区二区在线观看视频| 国产精品福利影院| 久久免费看少妇高潮| 日韩你懂的电影在线观看| 欧美日本免费一区二区三区| 色综合久久九月婷婷色综合| 成人免费毛片app| 国产成人av资源| 国产美女视频一区| 精品一区二区三区影院在线午夜 | 99re这里只有精品视频首页| 国产在线精品不卡| 久久91精品久久久久久秒播| 五月婷婷久久丁香| 亚洲gay无套男同| 一区二区久久久久| 亚洲高清免费观看高清完整版在线观看| 国产亚洲短视频| 国产日韩精品一区| 国产蜜臀av在线一区二区三区| www国产亚洲精品久久麻豆| 欧美一区二区三区免费视频 | av一区二区不卡| www.成人网.com| 91丨porny丨国产入口| va亚洲va日韩不卡在线观看| 丁香婷婷综合色啪| 成人深夜福利app| 色综合av在线| 欧美日韩精品一区二区天天拍小说| 色哟哟欧美精品| 欧美日韩高清在线播放| 777亚洲妇女| 精品久久人人做人人爰| 久久综合999| 国产精品你懂的在线欣赏| 亚洲人快播电影网| 亚洲第一成年网| 男女激情视频一区| 国产成人免费视| 91在线视频网址| 欧美日韩中文字幕一区| 精品久久五月天| 国产精品久久久久久亚洲毛片| 亚洲男人天堂一区| 免费观看一级欧美片| 国产成人在线视频免费播放| 91亚洲精华国产精华精华液| 欧美日韩国产经典色站一区二区三区 | 99久久亚洲一区二区三区青草| 一本大道久久精品懂色aⅴ| 欧美丰满少妇xxxbbb| 国产视频一区二区在线| 亚洲欧美视频在线观看| 视频一区视频二区中文字幕| 国产精品996| 91电影在线观看| 精品国产乱码91久久久久久网站| 国产精品久久久久久久久免费相片| 夜夜揉揉日日人人青青一国产精品| 蜜臀av国产精品久久久久| 成人一区二区三区| 在线电影一区二区三区| 国产精品护士白丝一区av| 日本网站在线观看一区二区三区| 成人永久免费视频| 日韩亚洲欧美一区二区三区| 亚洲人成小说网站色在线| 日韩国产欧美在线观看| av一区二区三区四区| 日韩欧美国产综合| 亚洲一区二区三区不卡国产欧美| 国产成人在线色| 91精品国产综合久久久久| 亚洲天堂精品视频| 国产一区二区伦理| 91精品国产色综合久久| 亚洲美女电影在线| 国产米奇在线777精品观看| 欧美三级视频在线播放| 中文字幕一区二区在线播放| 玖玖九九国产精品| 欧美三片在线视频观看| **性色生活片久久毛片| 国产成人综合在线播放| 精品精品国产高清一毛片一天堂| 亚洲自拍偷拍麻豆| 色香蕉久久蜜桃| 国产精品久久久一本精品 | 亚洲天堂精品视频| 国产成人精品一区二| 日韩精品一区二区三区视频| 五月婷婷色综合| 欧美日韩国产一区| 亚洲一区二区三区四区五区黄 | 国产精品成人免费精品自在线观看| 久久99精品久久只有精品| 日韩一区二区三区在线观看| 亚洲电影在线免费观看| 欧洲在线/亚洲| 一区二区三区四区在线免费观看| 成人18精品视频| 成人欧美一区二区三区| 99久久综合狠狠综合久久| 亚洲欧洲日产国产综合网| 99久久精品免费看国产免费软件|