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

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

?? soft_uart.asm

?? 常用子程序-61個-4.2M.rar
?? ASM
?? 第 1 頁 / 共 2 頁
字號:
TxEx2:      MOV   TxCnt,#11h            ; Set TX bit counter for a start.
            MOV   TxTime,#TxBitLen-1    ; Reset time slice count, stop bit
                                        ;   > 1 bit time for synch.
            SJMP  CheckRx               ; Restore state and exit.



;*******************************************************************************
;                             RS-232 Receive Routine
;*******************************************************************************


RS232RX:    MOV   C,RxPin               ; Get current serial bit value.
            JNB   RxCnt.4,RxData        ; Go if data bit.
            JNB   RxCnt.0,RxStop        ; Go if stop bit.


;Verify start bit.

RxStart:    JC    RxErr                 ; If bit=1, then not a valid start.
            MOV   RxCnt,#08h            ; Init counter to expect data.
            MOV   RxTime,#RxBitLen      ; Reset time slice count.
            SJMP  T0Ex                  ; Restore state and exit.


; Get Next Data Bit.

RxData:     MOV   A,RxShift             ; Get partial received byte.
            RRC   A                     ; Shift in new received bit.
            MOV   RxShift,A             ; Store partial result in buffer.
            INC   RxCnt                 ; Increment received bit count.
            MOV   RxTime,#RxBitLen      ; Reset time slice count.
            SJMP  T0Ex                  ; Restore state and exit.


; Store Data Byte, "push"ing it into the FIFO buffer.

RxStop:     CLR   EA                    ; Don't interrupt the following.
            MOV   A,RxBuf               ; "PUSH" the receive buffer.
            XCH   A,RxBuf+1
            XCH   A,RxBuf+2
            MOV   RxBuf,RxShift         ; Add just completed data to buffer.
            INC   RxDatCnt              ; Increment the received byte count.
            SETB  EA                    ; Re-enable interrupts.

            SETB  RxAvail               ; There is data in the RX buffer.
            PUSH  PSW                   ; Save Carry (received bit)for later.
            MOV   A,RxDatCnt            ; Check receiver buffer status.
            CJNE  A,#4,RxChk1           ; Is RX buffer overrun?
            SETB  OverrunErr            ; Set status reg overrun error flag.
            MOV   RxDatCnt,#3           ; Re-set buffer counter to "full".

RxChk1:     CJNE  A,#3,RxChk2           ; Is RX buffer full?
            SETB  RxFull                ; Set buffer full status.

RxChk2:     POP   PSW                   ; Retrieve last received bit in Carry.
            JC    RxEx                  ; If bit=0, then not a valid stop.
RxErr:      SETB  FramingErr            ; Remember bad start or stop status.

RxEx:       JB    TxOn,RxTimerOn        ; If transmit active, timer stays on,
            CLR   TR                    ;   otherwise turn timer off.
RxTimerOn:  CLR   RxOn                  ; Turn off receive active.
            SETB  RxTime.7              ; Set bit for no service to
                                        ;   RX Time Slice Branches.
            SETB  IE.0                  ; Re-enable RS-232 receive interrupts.
            AJMP  T0Ex                  ; Restore state and exit.


;*******************************************************************************
;                                  Subroutines
;*******************************************************************************


; BaudRate - Determine and set the baud rate from switches.
;   Note: if the baud rate is altered, the actual change will only occur when 
;   a transmit or receive is begun while the timer was not already running 
;   (i.e.: not already busy transmitting or receiving).

BaudRate:   MOV   DPTR,#BaudTable       ; Set pointer to baud rate table.
            ANL   A,#03h                ; Limit displacement for lookup.
            RL    A                     ; Double the table index since these 
                                        ;   are 2 byte entries.
            PUSH  ACC                   ; Save the table index for second byte.
            MOVC  A,@A+DPTR             ; Get first byte, and save as the high
            MOV   BaudHigh,A            ;    byte of the baud rate timer value.
            POP   ACC                   ; Get back the table index.
            INC   A                     ; Advance to next table entry.
            MOVC  A,@A+DPTR             ; Get second byte, and save as the low
            MOV   BaudLow,A             ;    byte of the baud rate timer value.
            RET


; Entries in BaudTable are for a timer setting of 1/4 of a bit time at the given
;   baud rate. The two values per entry are the high and low bytes of the value
;   respectively.

; Values are calculated as follows: 
;                                             Osc Frequency
;   1/4 Bit cell time (in machine cycles) = -----------------
;                                            Baud Rate * 48

; Example for 9600 baud with a 16MHz crystal:
;    16,000,000 / 9600 * 48 = 34.7222... machine cycles per quarter bit time.
;    Rounded, this is 35. The hexadecimal value for 35 is 23. 
;    10000 hex - 23 hex (truncated to 16 bits) = FFDD. Thus, the BaudTable entry
;    for 9600 baud is FF, DD hex.

BaudTable:  DB    0FEh,0EAh             ; 1200 baud. 
            DB    0FFh,75h              ; 2400 baud.
            DB    0FFh,0BBh             ; 4800 baud.
            DB    0FFh,0DDh             ; 9600 baud.


; TxSend - Initiate RS-232 Transmit.

TxSend:     JB    TxFull,$              ; Make sure TX buffer is free.
            SETB  TxFull                ; Reserve the buffer for our use.
            MOV   TxDat,A               ; Put character in buffer.
            JB    TxOn,TSTimerOn        ; Exit if transmitter already running.

            SETB  TxOn                  ; Transmit active flag set.
            MOV   TxCnt,#11h            ; Init bit counter to expect a start.
            MOV   TxTime,#TxBitLen      ; Reset time slice count.
            JB    RxOn,TSTimerOn        ; Exit if receiver already active.

            MOV   RTH,BaudHigh          ; Set up timer for selected baud rate.
            MOV   RTL,BaudLow
            MOV   TH,BaudHigh
            MOV   TL,BaudLow
            SETB  TR                    ; Start up the bit timer.
TSTimerOn:  RET


; PrByte - Output a byte as ASCII hexadecimal format.

PrByte:     PUSH  ACC                   ; Print ACC contents as ASCII hex.
            SWAP  A
            ACALL  HexAsc               ; Print upper nibble.
            ACALL  TxSend
            POP   ACC
            ACALL  HexAsc               ; Print lower nibble.
            ACALL  TxSend
            RET


; HexAsc - Convert a hexadecimal nibble to its ASCII character equivalent.

HexAsc:     ANL   A,#0Fh                ; Make sure we're working with only 
                                        ;   one nibble.
            CJNE  A,#0Ah,HA1            ; Test value range.
HA1:        JC    HAVal09               ; Value is 0 to 9.
            ADD   A,#7                  ; Value is A to F, needs pre-adjustment.
HAVal09:    ADD   A,#'0'                ; Adjust value to ASCII hex.
            RET


; GetRx - Retrieve a byte from the receive buffer, and return it in A.

GetRx:      CLR   EA                    ; Make sure this isn't interrupted.
            DEC   RxDatCnt              ; Decrement the buffer count.
            MOV   A,RxDatCnt            ; Get buffer count.
            JNZ   GRX1                  ; Test for empty receive buffer.
            CLR   RxAvail               ; If empty, clear data available status.
GRX1:       ADD   A,#RxBuf              ; Create a pointer to end of buffer.
            MOV   Temp,R0               ; Save R0.
            MOV   R0,A                  ; Put pointer where we can indirect.
            MOV   A,@R0                 ; Get last buffer data.
            MOV   R0,Temp               ; Restore R0.
            CLR   RxFull                ; Buffer can't be full anymore.
            SETB  EA                    ; Re-enable interrupts.
            RET


;*******************************************************************************
;                                      Reset
;*******************************************************************************

Reset:      MOV   SP,#2Fh               ; Initialize stack start.
            MOV   TCON,#0               ; Set timer off, INT0 to level trigger.
            MOV   P3,#0                 ; Turn off all status outputs.

; For this demo, we only set up the baud rate once at reset:

            MOV   A, P1                 ; Read baudrate bits from P1.
            RR    A                     ; The switches are on bits 2 and 1.
            ACALL BaudRate              ; Set up the selected baud rate.

            MOV   FLAGS,#0              ; Init all status flags.
            MOV   RxDatCnt,#0           ; Clear buffer count.
            MOV   IE,#93h               ; Turn on timer 0 interrupt and 
                                        ;   external interrupt 0.
            CLR   RTS                   ; Assert RTS so we can receive.


; The main program loop processes received data and sends it back to the 
;   transmitter in hexadecimal format. This insures that we can always fill 
;   up the receiver buffer (since the returned data is longer than the 
;   received data) for testing purposes. Example: if the letter "A" is 
;   received, we will echo "A41 ".

MainLoop:   JNB   RxAvail,$             ; Make sure an input byte is available.
            ACALL GetRx                 ; Get data from the receiver buffer.
            ACALL TxSend                ; Echo original character.
            ACALL PrByte                ; Output the char in hexadecimal format,
            MOV   A,#20h                ;   followed by a space.
            ACALL TxSend
            SJMP  MainLoop              ; Repeat.

            END

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
大桥未久av一区二区三区中文| 成人一区二区视频| 在线免费亚洲电影| 日韩精品最新网址| 亚洲视频资源在线| 久久精品国产亚洲a| 99精品视频一区二区三区| 欧美一级理论片| 亚洲一区二区三区视频在线| 成人久久久精品乱码一区二区三区| 欧美国产精品一区二区三区| 蜜臀av性久久久久蜜臀aⅴ四虎 | 国产精品日韩精品欧美在线| 日韩一区精品字幕| 91麻豆福利精品推荐| 国产丝袜在线精品| 另类欧美日韩国产在线| 国产午夜精品久久久久久久| 一本色道a无线码一区v| 国产日韩欧美精品综合| 狠狠色综合日日| 欧美一区中文字幕| 婷婷久久综合九色国产成人| 在线免费一区三区| 激情五月婷婷综合| 亚洲男人的天堂在线aⅴ视频 | 奇米综合一区二区三区精品视频| 欧美日韩在线三区| 亚洲色图欧美在线| 日韩一区二区三| 成人禁用看黄a在线| 日韩毛片一二三区| 日韩欧美的一区| 色哟哟一区二区在线观看| 国模无码大尺度一区二区三区| 亚洲综合一区二区三区| 久久丝袜美腿综合| 大白屁股一区二区视频| 亚洲成在线观看| 精品免费国产一区二区三区四区| 激情综合色综合久久| 欧美精品一区二区三区很污很色的| 国产伦理精品不卡| 国产精品美女久久久久久久网站| 欧美巨大另类极品videosbest | 色又黄又爽网站www久久| 免费在线观看一区二区三区| 亚洲女同女同女同女同女同69| xnxx国产精品| 91精品国产综合久久香蕉的特点| 久久99久久久欧美国产| 一区二区三区日韩精品视频| 欧美日本一道本| 狠狠色狠狠色综合日日91app| 一区二区三区在线不卡| 中文字幕精品—区二区四季| 欧美精品一区在线观看| 7777女厕盗摄久久久| 91九色02白丝porn| 久久国内精品自在自线400部| 有码一区二区三区| 精品欧美乱码久久久久久1区2区| 91精品福利视频| av一区二区久久| 首页国产欧美久久| 亚洲国产日韩av| 久久久久国产精品麻豆ai换脸 | 制服丝袜一区二区三区| 欧美网站一区二区| 国产成人精品免费在线| 夜夜嗨av一区二区三区四季av| 国产精品区一区二区三| 国产欧美精品一区二区色综合| 久久久久久久久久看片| 亚洲精品一线二线三线| 精品国内片67194| 久久综合久色欧美综合狠狠| 精品国产乱子伦一区| 久久综合九色综合欧美98| 精品国产sm最大网站| 久久综合久久综合久久综合| 久久久美女艺术照精彩视频福利播放| 精品奇米国产一区二区三区| 精品国产成人在线影院 | 一区免费观看视频| 日韩欧美一级在线播放| 欧美不卡在线视频| 久久久亚洲国产美女国产盗摄| 国产日韩欧美精品在线| 亚洲视频一二三| 亚洲一二三区视频在线观看| 日韩电影在线一区二区三区| 国产精品九色蝌蚪自拍| 欧美精品一区二区三| 国产亚洲精品7777| 亚洲欧美日韩系列| 亚洲成a人片在线观看中文| 蜜臀国产一区二区三区在线播放 | 国产老女人精品毛片久久| 亚洲国产aⅴ成人精品无吗| 午夜精品久久久久久不卡8050| 毛片一区二区三区| 成人免费高清在线观看| 91黄色小视频| 欧美成人福利视频| 国产精品久久综合| 亚洲成a人片综合在线| 国产麻豆视频一区| 色婷婷国产精品| 精品久久久影院| 亚洲精品日日夜夜| 国产在线精品视频| 欧美午夜不卡视频| 欧美激情综合网| 亚洲va国产天堂va久久en| 国产v综合v亚洲欧| 成人av网站免费| 在线不卡中文字幕播放| 中文字幕不卡的av| 日韩不卡一区二区| 成人精品免费网站| 91精品国产91久久久久久一区二区| 日本一区二区三区四区在线视频| 午夜精品福利在线| 成人av在线播放网址| 精品噜噜噜噜久久久久久久久试看| 中文字幕一区二区三区四区| 日本亚洲三级在线| 色综合天天性综合| 91视视频在线观看入口直接观看www | 久久综合色婷婷| 亚洲亚洲人成综合网络| 国产成人一区在线| 欧美一区二区播放| 一区二区三区中文免费| 国产91精品露脸国语对白| 在线播放91灌醉迷j高跟美女| 国产精品久久久久影院亚瑟| 国产一区二区三区久久悠悠色av| 精品视频一区三区九区| 亚洲三级在线免费观看| 国产伦精品一区二区三区免费| 欧美精品 日韩| 亚洲综合视频在线观看| av欧美精品.com| 亚洲国产成人在线| 国产伦精品一区二区三区在线观看| 制服丝袜亚洲色图| 午夜一区二区三区在线观看| 91麻豆国产精品久久| 中文字幕在线观看一区二区| 国产精品一区三区| 精品国产电影一区二区| 久久99国内精品| 欧美一区2区视频在线观看| 亚洲成av人片在线观看无码| 色伊人久久综合中文字幕| 亚洲视频免费在线| 91亚洲精品一区二区乱码| 国产精品不卡在线| 成人91在线观看| 亚洲欧美日韩国产一区二区三区| 成人app在线观看| 国产精品久久久久三级| 成人精品视频一区| 亚洲视频资源在线| 在线看不卡av| 亚洲国产综合人成综合网站| 欧美自拍偷拍一区| 亚洲成a人v欧美综合天堂| 欧美日韩你懂的| 免费高清不卡av| 国产亚洲欧洲997久久综合| 国产成人h网站| 亚洲视频一二区| 欧美三级日韩三级国产三级| 亚洲国产人成综合网站| 91精品久久久久久久91蜜桃 | 国产成人自拍高清视频在线免费播放| 2020国产精品久久精品美国| 国产大陆亚洲精品国产| 中文在线一区二区| 91成人免费电影| 亚洲成国产人片在线观看| 日韩一区二区三区四区| 国产精品一区二区在线观看网站| 国产欧美日韩综合精品一区二区| 久久超碰97中文字幕| 日韩精品资源二区在线| 激情图区综合网| 久久精品人人做| 色国产综合视频| 日韩精品久久理论片| 久久久久久9999| 在线看日韩精品电影| 麻豆成人久久精品二区三区小说| 久久精品一区二区三区av| 91啦中文在线观看| 另类欧美日韩国产在线| 亚洲视频你懂的|