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

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

?? bootldr3.asm

?? pic bootloader 用于PIC單片機的主程序下載
?? ASM
?? 第 1 頁 / 共 2 頁
字號:
;
;  bootldr3.asm      Flash-resident bootloader for the PIC 16f873
;
;  Derived from the original Microchip program, boot877.asm
;

;
;  This bootloader uses the state of PB1 to determine action.  If PB1 is
;  low on reset, the bootloader prepares to download a user file into
;  memory.  If PB1 is high on reset, the bootloader tests the value in
;  a reserved flash cell, CodeStatus, to see if memory contains a valid
;  code image.  If CodeStatus is zero, the code image is assumed valid
;  and control jumps to StartUserCode to run the downloaded image.
;

        list p=16f873, st=OFF, x=OFF, n=0
        errorlevel -302
        #include <p16f873.inc>

        #include  "bank.mac"

        __CONFIG _BODEN_OFF & _CP_OFF & _PWRTE_ON & _WDT_OFF & _WRT_ENABLE_ON & _XT_OSC & _DEBUG_OFF & _CPD_OFF & _LVP_OFF

;-----------------------------------------------------------------------------
;Constants
;

;
;  Define the version as a byte literal.  This will be displayed as part
;  of the user prompt, as two hex characters.
;

VERSION         equ     01

;
;  I changed the download selector input to PB1 from the original of
;  PB0.  I didn't want to tie up the valuable INT* pin for this selection.
;

TEST_INPUT      EQU     1       ;Port B Pin 1 input indicates download

;
;  The following baud rate constants assume a 4.0 MHz crystal.
;

BAUD_9600       equ     0x19
BAUD_19200      equ     0x0c

BAUD_DEFAULT    equ     BAUD_9600

;-----------------------------------------------------------------------------
;Variables in bank0

                CBLOCK  0x20
                AddressH:       1       ;flash program memory address high byte
                AddressL:       1       ;flash program memory address low byte
                NumWords:       1       ;number of words in line of hex file
                Checksum:       1       ;byte to hold checksum of incoming data
                Counter:        1       ;to count words being saved or programmed
                TestByte:       1       ;byte to show reset vector code received
                HexByte:        1       ;byte from 2 incoming ascii characters
                Temp:           1       ;temp byte for general use
                DataPointer:    1       ;pointer to data in buffer
                DataArray:      0x40    ;buffer for storing incoming data
                ENDC

;=============================================================================
;Reset vector code

                ORG     0x0000 

ResetVector:
                movlw   high Main
                movwf   PCLATH          ;set page bits for page3
                goto    Main            ;go to boot loader

;=============================================================================
;Start of boot code in upper memory traps accidental entry into boot code area

;               ORG     0x1e00          ;Use last part of page3 for PIC16F876/7
;               ORG     0x0e00          ;Use last part of page1 for PIC16F873/4
;               ORG     0x0600          ;Use last part of page0 for PIC16F870/1

        ORG     0xe00                   ;leave lots of room for loader

StartOfBoot:
        movlw   high TrapError  ;trap if execution runs into boot code
        movwf   PCLATH          ;set correct page
TrapError:
        goto    TrapError       ;trap error and wait for reset

;-----------------------------------------------------------------------------
;Relocated user reset code to jump to start of user code
;Must be in bank0 before jumping to this routine

StartUserCode:
                clrf    PCLATH          ;set correct page for reset condition 
                nop                     ;relocated user code replaces this nop
                nop                     ;relocated user code replaces this nop
                nop                     ;relocated user code replaces this nop
                nop                     ;relocated user code replaces this nop
                movlw   high TrapError1 ;trap if no goto in user reset code
                movwf   PCLATH          ;set correct page
TrapError1:
                goto    TrapError1      ;trap error and wait for reset

;-----------------------------------------------------------------------------
;Program memory location to show whether valid code has been programmed

CodeStatus:
                DA      0x3fff          ;0 for valid code, 0x3fff for no code

;-----------------------------------------------------------------------------
;Main boot code routine
;Tests to see if a load should occur and if valid user code exists

Main:
                Bank0                   ;change to bank0 in case of soft reset
                btfss   PORTB,TEST_INPUT ;check pin for boot load               
                goto    Loader          ;if low then do bootload
                call    LoadStatusAddr  ;load address of CodeStatus word
                call    FlashRead       ;read data at CodeStatus location
                Bank2                   ;change from bank3 to bank2
                movf    EEDATA,F        ;set Z flag if data is zero
                Bank0                   ;change from bank2 to bank0
                btfss   STATUS,Z        ;test Z flag
TrapError2:
                goto    TrapError2      ;if not zero then is no valid code
                goto    StartUserCode   ;if zero then run user code

;-----------------------------------------------------------------------------
;Start of routine to load and program new code

Loader:
        Bank0                           ; entry from vector at end of ROM
        clrf    TestByte                ; indicate no reset vector code yet

        call    LoadStatusAddr          ; load address of CodeStatus word
        movlw   0x3f                    ; load data to indicate no program
        movwf   EEDATH
        movlw   0xff                    ; load data to indicate no program
        movwf   EEDATA
        call    FlashWrite              ; write new CodeStatus word

        call    SerialSetup             ; set up serial port
        goto    GetCmd                  ; skip initial prompt

;-----------------------------------------------------------------------------
;Get new line of hex file starting with ':'
;Get first 8 bytes after ':' and extract address and number of bytes

GetNewLine:
        call    SendCRLF        ; make it pretty
        movlw   VERSION         ; get version number
        call    SendByte        ; send as two hex digits
        movlw   '>'             ; issue prompt
        call    SerialTransmit
GetCmd:
        call    SerialReceive   ; get new byte from serial port
        xorlw   0x0a            ; linefeed?
        btfsc   STATUS,Z
        goto    GetCmd          ; yes, just skip silently
        xorlw   0x0a            ; restore char
        call    SerialTransmit  ; echo char
        xorlw   ':'             ; check if ':' received
        btfsc   STATUS,Z
        goto    GetRec          ; got :, start processing record
        xorlw   ':'             ; restore the char
        xorlw   0dh             ; not :, is it CR?
        btfsc   STATUS,Z
        goto    GetNewLine      ; got CR, just start over
        xorlw   0dh             ; restore the char
        xorlw   'G'             ; was it GO command?
        btfsc   STATUS,Z
        goto    DoGoCmd         ; do the GO


;
;  Control reaches this point if the user sent an unknown command.
;  Receive and echo all characters until CR.
;

EatLine:
        call    SerialReceive   ; get char from serial port
        xorlw   0ah             ; line-feed?
        btfsc   STATUS,Z
        goto    EatLine         ; yes, ignore it
        xorlw   0ah             ; recover char
        xorlw   0dh             ; CR?
        btfsc   STATUS,Z
        goto    GetNewLine      ; yes, done with this line
        xorlw   0dh             ; recover char
        call    SerialTransmit  ; echo the char
        goto    EatLine         ; loop until hit CR

;
;  Control reaches this point after user enters a semicolon, marking
;  the start of a HEX record.  Note that the leading semi has already
;  been echoed.
;

GetRec:
        clrf    Checksum        ; start with checksum zero
        call    GetHexByte      ; get number of program data bytes in line
        andlw   0x1F            ; limit number in case of error in file
        movwf   NumWords
        bcf     STATUS,C
        rrf     NumWords,F      ; divide by 2 to get number of words
        call    GetHexByte      ; get upper half of program start address
        movwf   AddressH

        call    GetHexByte      ; get lower half of program start address
        movwf   AddressL

        bcf     STATUS,C
        rrf     AddressH,F      ;divide address by 2 to get word address
        rrf     AddressL,F

        call    GetHexByte      ;get record type
        xorlw   0x01
        btfsc   STATUS,Z        ;check if end of file record (0x01)
        goto    FileDone        ;if end of file then all done

        movf    HexByte,W
        xorlw   0x00
        btfss   STATUS,Z        ;check if regular line record (0x00)
        goto    LineDone        ;if not then ignore line and send '.'

        movlw   0xe0
        addwf   AddressH,W      ;check if address >= 0x2000 (was <)
        btfsc   STATUS,C        ;which is ID locations and config bits
        goto    LineDone        ;if so then ignore line and send '.'

;-----------------------------------------------------------------------------
;Get data bytes and checksum from line of hex file

        movlw   DataArray
        movwf   FSR             ;set pointer to start of array
        movf    NumWords,W
        movwf   Counter         ;set counter to number of words

GetData:
        call    GetHexByte      ;get low data byte
        movwf   INDF            ;save in array
        incf    FSR,F           ;point to high byte

        call    GetHexByte      ;get high data byte
        movwf   INDF            ;save in array
        incf    FSR,F           ;point to next low byte

        decfsz  Counter,F
        goto    GetData

        call    GetHexByte      ;get checksum
        movf    Checksum,W      ;check if checksum correct
        btfss   STATUS,Z
        goto    ErrorMessage

;
;  Get saved data one word at a time to program into flash 
;

        movlw   DataArray
        movwf   FSR             ;point to start of array
        movf    NumWords,W
        movwf   Counter         ;set counter to half number of bytes

;
;  Check if address is in reset code area
;

CheckAddress:
        movf    AddressH,W      ;checking for boot location code
        btfss   STATUS,Z        ;test if AddressH is zero 
        goto    CheckAddress1   ;if not go check if reset code received

        movlw   0xfc    
        addwf   AddressL,W      ;add 0xfc (-4) to address
        btfsc   STATUS,C        ;no carry means address < 4
        goto    CheckAddress1   ;if not go check if reset code received

        bsf     TestByte,0      ;show that reset vector code received
        movf    AddressL,W      ;relocate addresses 0-3 to new location
        addlw   low (StartUserCode + 1) ;add low address to new location
        Bank2                   ;change from bank0 to bank2
        movwf   EEADR           ;load new low address
        movlw   high (StartUserCode + 1) ;get new location high address
        movwf   EEADRH          ;load high address
        goto    LoadData        ;go get data byte and program into flash

;-----------------------------------------------------------------------------
;Check if reset code has been received
;Check if address is too high and conflicts with boot loader

CheckAddress1:
        btfss   TestByte,0      ;check if reset vector code received first
        goto    ErrorMessage    ;if not then error

        movlw   high StartOfBoot ;get high byte of address
        subwf   AddressH,W
        btfss   STATUS,C        ;test if less than boot code address 
        goto    LoadAddress     ;yes so continue with write
        btfss   STATUS,Z        ;test if equal to boot code address 
        goto    ErrorMessage    ;no so error in high byte of address

        movlw   low StartOfBoot ;get low byte of address
        subwf   AddressL,W
        btfsc   STATUS,C        ;test if less than boot code address 
        goto    ErrorMessage    ;no so error in address

;-----------------------------------------------------------------------------
;Load address and data and write data into flash

LoadAddress:
        movf    AddressH,W      ;get high address
        Bank2                   ;change from bank0 to bank2
        movwf   EEADRH          ;load high address
        Bank0                   ;change from bank2 to bank0
        movf    AddressL,W      ;get low address
        Bank2                   ;change from bank0 to bank2
        movwf   EEADR           ;load low address

LoadData:
        movf    INDF,W          ;get low byte from array
        movwf   EEDATA          ;load low byte
        incf    FSR,F           ;point to high data byte
        movf    INDF,W          ;get high byte from array
        movwf   EEDATH          ;load high byte
        incf    FSR,F           ;point to next low data byte

        call    FlashWrite      ;write data to program memory

        Bank0                   ;change from bank3 to bank0
        incfsz  AddressL,F      ;increment low address byte

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费在线播放| 波多野结衣在线aⅴ中文字幕不卡| 九九国产精品视频| 91亚洲国产成人精品一区二区三 | 久久蜜臀中文字幕| 一级日本不卡的影视| 国产激情精品久久久第一区二区 | 日精品一区二区| av在线不卡网| 久久久蜜桃精品| 久久精品国产久精国产爱| 欧美性xxxxxxxx| 亚洲精选在线视频| 99久久精品免费看国产| 久久久综合激的五月天| 琪琪久久久久日韩精品| 精品视频在线看| 亚洲男同性恋视频| 99在线精品观看| 国产精品―色哟哟| 国产盗摄一区二区| 久久久亚洲精品一区二区三区| 日本一区中文字幕| 日韩欧美在线影院| 另类欧美日韩国产在线| 欧美一卡二卡在线观看| 午夜天堂影视香蕉久久| 91成人免费在线视频| 亚洲欧美日韩国产综合| 色欧美乱欧美15图片| 亚洲人快播电影网| 色偷偷久久人人79超碰人人澡 | 精品少妇一区二区三区在线视频| 午夜精品爽啪视频| 制服丝袜亚洲色图| 麻豆精品在线视频| 久久新电视剧免费观看| 国产精品自拍三区| 亚洲欧美综合色| 色欲综合视频天天天| 亚洲成av人片在www色猫咪| 欧美日韩另类国产亚洲欧美一级| 日韩国产欧美三级| 精品免费日韩av| 成人开心网精品视频| 亚洲欧美福利一区二区| 欧美日韩一区二区欧美激情| 日本一道高清亚洲日美韩| 久久你懂得1024| 色视频成人在线观看免| 男人的天堂久久精品| 欧美精品一区二区三区蜜桃 | 在线精品视频免费观看| 无码av免费一区二区三区试看| 91精品国产一区二区三区蜜臀 | 婷婷综合久久一区二区三区| 欧美一区二区在线不卡| 国产精品一卡二| 一区二区三区美女| 日韩精品一区二区三区三区免费 | 蜜臀av性久久久久av蜜臀妖精| 日韩免费福利电影在线观看| 国产69精品久久久久毛片| 一区二区三区不卡视频在线观看| 欧美日韩的一区二区| 国产一区二区女| 亚洲www啪成人一区二区麻豆| 欧美精品一区二区三区高清aⅴ | caoporn国产精品| 亚洲第一久久影院| 2024国产精品| 色婷婷激情综合| 国产精品影音先锋| 偷拍与自拍一区| √…a在线天堂一区| 精品捆绑美女sm三区| 91在线视频播放| 国产一区二区三区国产| 亚洲不卡av一区二区三区| 亚洲国产精品二十页| 欧美一区二区美女| 色八戒一区二区三区| 成人丝袜高跟foot| 乱一区二区av| 琪琪久久久久日韩精品| 亚洲综合色视频| 亚洲欧洲日产国码二区| 久久蜜桃一区二区| 欧美一区二区精品在线| 欧美视频完全免费看| 99久久伊人精品| 国产一区91精品张津瑜| 蜜桃视频在线一区| 秋霞影院一区二区| 亚洲成av人片观看| 国内精品免费**视频| 亚洲国产乱码最新视频| 亚洲男同1069视频| 亚洲男人天堂av网| 日韩一区在线播放| 中日韩av电影| 国产精品嫩草99a| 国产三区在线成人av| 久久综合国产精品| wwwwww.欧美系列| 久久久www免费人成精品| 久久综合色天天久久综合图片| 欧美电视剧在线观看完整版| 在线播放一区二区三区| 欧美日韩二区三区| 91精品黄色片免费大全| 欧美精品乱人伦久久久久久| 欧美日韩一区 二区 三区 久久精品| 日本韩国欧美三级| 欧美曰成人黄网| 欧美日韩免费一区二区三区 | 99久久er热在这里只有精品15| 国产大陆精品国产| 粉嫩av一区二区三区粉嫩| 粉嫩av亚洲一区二区图片| 成人福利视频网站| 色婷婷激情久久| 欧美精品精品一区| 精品久久久久久久久久久久久久久 | 99久久久久久| 在线免费一区三区| 欧美一区二区三区精品| 久久婷婷成人综合色| 国产精品福利一区| 亚洲线精品一区二区三区| 五月婷婷激情综合| 激情另类小说区图片区视频区| 国产成人av福利| 色94色欧美sute亚洲线路一久| 欧美日韩色综合| 久久蜜桃一区二区| 亚洲精品视频一区| 日本免费在线视频不卡一不卡二 | 久久午夜羞羞影院免费观看| 国产精品丝袜黑色高跟| 亚洲国产视频直播| 麻豆91免费观看| 99久久国产免费看| 日韩午夜在线观看| 国产精品毛片无遮挡高清| 亚洲国产一区二区三区| 国产精品亚洲专一区二区三区 | 亚洲精品欧美二区三区中文字幕| 亚洲国产乱码最新视频 | 久久精品国产亚洲一区二区三区| 国产一区二区久久| 欧美一a一片一级一片| wwwwxxxxx欧美| 亚洲一卡二卡三卡四卡无卡久久| 美女mm1313爽爽久久久蜜臀| 国产成人免费视频精品含羞草妖精| 色诱视频网站一区| 久久久三级国产网站| 亚洲午夜视频在线观看| 丁香婷婷深情五月亚洲| 欧美日韩国产高清一区二区三区| 久久亚洲精华国产精华液| 亚洲va国产天堂va久久en| 欧美一级免费观看| 日韩美女视频一区二区| 久久99精品国产.久久久久久| 在线观看网站黄不卡| 国产欧美一区二区三区沐欲 | 日韩欧美精品在线视频| 亚洲三级理论片| 国产乱妇无码大片在线观看| 欧美日韩国产精选| 一区二区三区在线不卡| 东方aⅴ免费观看久久av| 精品精品国产高清a毛片牛牛| 一区二区三区高清| 91在线观看视频| 国产精品剧情在线亚洲| 韩国欧美国产1区| 91精品在线观看入口| 亚洲综合色丁香婷婷六月图片| 99精品视频一区| 国产精品初高中害羞小美女文| 国产在线视频一区二区| 日韩精品一区二区在线观看| 三级一区在线视频先锋| 欧美私人免费视频| 亚洲五月六月丁香激情| 色综合网色综合| 亚洲激情网站免费观看| 96av麻豆蜜桃一区二区| 国产精品白丝在线| 99热这里都是精品| 中文字幕一区二区三区不卡| 国产91露脸合集magnet| 欧美激情综合五月色丁香小说| 韩日精品视频一区| 26uuuu精品一区二区| 国产成人免费av在线| 欧美国产日本韩|