亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
一道本成人在线| 亚洲日本va在线观看| 中文字幕国产一区| 天天综合网 天天综合色| 粉嫩高潮美女一区二区三区| 欧美日韩国产经典色站一区二区三区| 久久免费国产精品| 亚洲一区影音先锋| 不卡免费追剧大全电视剧网站| 日韩一区二区三区av| 亚洲五码中文字幕| 91免费观看在线| 一色桃子久久精品亚洲| 国产原创一区二区三区| 日韩女优电影在线观看| 天天综合色天天| 欧美日韩免费高清一区色橹橹| 国产精品久久久久一区二区三区| 国产一区二区三区日韩| 日韩欧美专区在线| 青青青爽久久午夜综合久久午夜| 色综合咪咪久久| 亚洲色图清纯唯美| 成人18视频日本| 国产精品系列在线| 成人av资源网站| 国产精品午夜在线观看| 高清国产一区二区| 国产日韩在线不卡| 成人久久视频在线观看| 中文一区二区完整视频在线观看 | 成人免费在线观看入口| 成人午夜在线视频| 中文欧美字幕免费| 成人毛片在线观看| 亚洲欧美一区二区三区极速播放| 99久久99久久免费精品蜜臀| 自拍偷拍亚洲综合| 欧洲在线/亚洲| 成人免费视频caoporn| 欧美国产日韩在线观看| 99热国产精品| 亚洲另类春色国产| 欧美色网站导航| 三级成人在线视频| 欧美xxx久久| 国产精品一区久久久久| 国产日韩欧美在线一区| 99精品欧美一区二区蜜桃免费| 亚洲柠檬福利资源导航| 欧美日本在线视频| 久久av老司机精品网站导航| 久久久久久综合| 99re热这里只有精品免费视频 | 欧美大肚乱孕交hd孕妇| 国产黑丝在线一区二区三区| 1000精品久久久久久久久| 精品视频色一区| 国产乱人伦精品一区二区在线观看| 中文在线资源观看网站视频免费不卡| 91视频.com| 免费的国产精品| 专区另类欧美日韩| 日韩一级欧美一级| aaa欧美色吧激情视频| 天天影视网天天综合色在线播放| 久久久亚洲精品石原莉奈| 色哟哟在线观看一区二区三区| 亚洲mv在线观看| 亚洲国产经典视频| 欧美老人xxxx18| 99v久久综合狠狠综合久久| 日本sm残虐另类| 国产精品护士白丝一区av| 欧美日韩mp4| 高清不卡一区二区在线| 琪琪久久久久日韩精品| 亚洲欧美韩国综合色| 亚洲精品在线网站| 欧美日韩一本到| 成人激情电影免费在线观看| 美腿丝袜亚洲色图| 亚洲午夜精品17c| 中文字幕精品一区二区精品绿巨人 | 日本韩国一区二区三区视频| 国产九色精品成人porny| 亚洲va国产天堂va久久en| 国产精品久久久久久久蜜臀| 日韩视频在线你懂得| 色屁屁一区二区| 成人短视频下载| 国内成+人亚洲+欧美+综合在线| 午夜精品一区二区三区电影天堂 | 欧美日韩在线免费视频| 99精品国产99久久久久久白柏| 蜜桃精品视频在线观看| 亚洲成a人片在线观看中文| 亚洲人吸女人奶水| 国产精品女主播av| 国产色婷婷亚洲99精品小说| 欧美电影免费观看高清完整版在线 | 精品国精品国产尤物美女| 亚洲国产精品自拍| 国产女同性恋一区二区| 91精品国产麻豆| 在线欧美小视频| 日本久久电影网| 色av一区二区| 97成人超碰视| 国产一区二区不卡老阿姨| 天堂一区二区在线免费观看| 亚洲一区免费观看| 色呦呦国产精品| www.欧美色图| 99久久婷婷国产精品综合| 国产成人av影院| 国产999精品久久| 成人亚洲精品久久久久软件| 国产精品亚洲成人| 国产不卡免费视频| 福利一区福利二区| eeuss鲁一区二区三区| 91丝袜美腿高跟国产极品老师| 色综合久久88色综合天天6| 色婷婷亚洲综合| 欧美日韩精品免费| 欧美一区午夜精品| 欧美精品一区二区在线观看| 2021国产精品久久精品| 国产日韩欧美高清在线| 中文字幕亚洲精品在线观看| 亚洲欧美视频一区| 亚洲bt欧美bt精品| 精品系列免费在线观看| 国产精品99久久不卡二区| 成人黄色777网| 欧美日韩在线精品一区二区三区激情| 欧美精品1区2区3区| 久久亚洲精品国产精品紫薇| 中文字幕在线不卡| 亚洲成精国产精品女| 精品夜夜嗨av一区二区三区| 成人国产精品免费| 欧美高清你懂得| 久久久精品免费免费| 亚洲激情综合网| 看片的网站亚洲| 91在线免费视频观看| 91精品久久久久久久99蜜桃| 国产精品美女久久久久久久网站| 亚洲一区二区三区四区在线观看| 久久成人免费网站| 色综合久久中文综合久久牛| 91精品国产品国语在线不卡| 中文字幕国产一区| 免费不卡在线视频| kk眼镜猥琐国模调教系列一区二区 | 欧美精品欧美精品系列| 亚洲国产激情av| 日本三级亚洲精品| 色婷婷久久综合| 久久色在线视频| 亚洲福利国产精品| 成人免费av在线| 精品少妇一区二区三区| 一区二区三区视频在线看| 国产伦精一区二区三区| 欧美日韩成人在线| 亚洲精品免费在线播放| 国产精品一区二区你懂的| 欧美丰满美乳xxx高潮www| 成人免费小视频| 国产69精品久久久久毛片| 欧美tickling网站挠脚心| 午夜视频久久久久久| 一本色道久久综合亚洲aⅴ蜜桃| 精品成人在线观看| 日本不卡视频一二三区| 欧美视频在线一区| 亚洲人精品一区| 成人综合日日夜夜| 国产亚洲1区2区3区| 激情小说欧美图片| 日韩精品自拍偷拍| 琪琪久久久久日韩精品| 欧美日韩国产一级片| 一区二区三区中文字幕精品精品| 成人动漫精品一区二区| 国产婷婷色一区二区三区| 久久精品国产精品青草| 91精品国产色综合久久不卡蜜臀| 亚洲午夜国产一区99re久久| 在线中文字幕不卡| 亚洲精品国产一区二区精华液| 成+人+亚洲+综合天堂| 国产精品电影一区二区| av激情成人网| 一区二区三区视频在线看| 欧美最猛性xxxxx直播| 亚洲一区二区美女|