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

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

?? soft_uart.asm

?? 51系列單片機常用子程序
?? ASM
?? 第 1 頁 / 共 2 頁
字號:

;*******************************************************************************

;        Duplex UART Routines for the 8xC751 and 8xC752 Microcontrollers

;*******************************************************************************


; This is a demo program showing a way to perform simultaneous RS-232 
; transmit and receive using only one hardware timer. 

; The transmit and receive routines divide each bit time into 4 slices to 
; allow synchronizing to incoming data that may be out of synch with outgoing 
; data.

; The main program loop in this demo 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 ".

;*******************************************************************************


$Title(Duplex UART Routines for the 751/752)
$Date(8/20/92)
$MOD751


;*******************************************************************************
;                                   Definitions
;*******************************************************************************


; Miscellaneous

TxBitLen    EQU   -4 + 1                ; Timer slices per serial bit transmit.
RxBitLen    EQU   -4 + 1                ; Timer slices per serial bit receive.
RxHalfBit   EQU   (RxBitLen / 4) + 1    ; Timer slices for a partial bit time.
                                        ;   Used to adjust the input sampling 
                                        ;   time point.

; Note:  TxBitLen and RxBitLen are kept separate in order to facilitate the
;   possibility of having different transmit and receive baud rates. The timer
;   would be set up to give four slices for the fastest baud rate, and the
;   BitLen for the slower channel would be set longer for the slower baud rate.
;   BitLen = -4 + 1 gives four timer interrupts per bit. BitLen = -8 + 1 would
;   give 8 slices, BitLen = -16 + 1 would give 16 slices, etc.

TxPin       BIT   P1.0                  ; RS-232 transmit pin (output).
RxPin       BIT   P1.5                  ; RS-232 receive pin (input).
RTS         BIT   P1.3                  ; RS-232 request to send pin (output).
CTS         BIT   P1.6                  ; RS-232 clear to send pin (input).
; Note: P1.1 and P1.2 are used to input the baud rate selection.


; RAM Locations

Flags       DATA  20h                   ; Miscellaneous bit flags (see below).
TxOn        BIT   Flags.0               ; Indicates transmitter is on (busy).
RxOn        BIT   Flags.1               ; Indicates receiver is on (busy).
TxFull      BIT   Flags.2               ; Transmit buffer (1 byte only) is full.
RxFull      BIT   Flags.3               ; Receiver buffer is full.
RxAvail     BIT   Flags.4               ; RX buffer is not empty.
OverrunErr  BIT   Flags.6               ; Overrun error flag.
FramingErr  BIT   Flags.7               ; Framing error flag.

BaudHigh    DATA  21h                   ; High byte timer value for baud rate.
BaudLow     DATA  22h                   ; Low byte timer value for baud rate.

TxCnt       DATA  23h                   ; RS-232 byte transmit bit counter.
TxTime      DATA  24h                   ; RS-232 transmit time slice count.
TxShift     DATA  25h                   ; Transmitter shift register.
TxDat       DATA  26h                   ; Transmitter holding register.

RxCnt       DATA  27h                   ; RS-232 byte receive bit counter.
RxTime      DATA  28h                   ; RS-232 receive time slice count.
RxShift     DATA  29h                   ; Receiver shift register.
RxDatCnt    DATA  2Ah                   ; Received byte count.
RxBuf       DATA  2Bh                   ; Receive buffer (3 bytes long).

Temp        DATA  2Fh                   ; Temporary holding register.


;*******************************************************************************
;                                Interrupt Vectors
;*******************************************************************************

            ORG   00h                   ; Reset vector.
            AJMP  RESET


            ORG   03h                   ; External interrupt 0
            AJMP  Intr0                 ; (received RS-232 start bit).


            ORG   0Bh                   ; Timer 0 overflow interrupt.
            AJMP  Timer0                ; (4X the RS-232 bit rate).
        
            ORG   13h                   ; External interrupt 1.
            RETI                        ; (not used).

            ORG   1Bh                   ; Timer I interrupt.
            RETI                        ; (not used).

            ORG   23h                   ; I2C interrupt.
            RETI                        ; (not used).


;*******************************************************************************
;                               Interrupt Handlers
;*******************************************************************************


; External Interrupt Int0.
;   RS-232 start bit transition.

Intr0:      PUSH  ACC                   ; Save accumulator,
            PUSH  PSW                   ;   and status.
            CLR   IE.0                  ; Disable more RX interrupts.

            SETB  RxOn                  ; Set receive active flag.
            MOV   RxCnt,#11h            ; Set bit counter to expect a start.
            MOV   RxTime,#RxHalfBit     ; First sample is at a partial bit time.
            JB    TxOn,I0TimerOn        ; If TX active then timer is on.

            MOV   RTH,BaudHigh          ; Set up timer for selected baud rate.
            MOV   RTL,BaudLow
            MOV   TH,BaudHigh
            MOV   TL,BaudLow
            SETB  TR                    ; Start timer 0.

I0TimerOn:  MOV   A,RxDatCnt            ; Check for buffer about to be full:
            CJNE  A,#2,Int0Ex           ;   one space left and a byte starting.
            SETB  RTS                   ; If so, tell whoever is on the 
                                        ;   other end to wait.

Int0Ex:     POP   PSW                   ; Restore status,
            POP   ACC                   ;   and accumulator.
            RETI


; Timer 0 Interrupt
;   This is used to generate time slices for both serial transmit and receive
;   functions. 

Timer0:     PUSH  ACC                   ; Save accumulator,
            PUSH  PSW                   ;   and status.
            JNB   TxTime.7,RS232TX      ; Is this an active time slice
                                        ;   for an RS-232 transmit?
            JNB   TxOn,CheckRx          ; If transmit is active,
            INC   TxTime                ;   increment the time slice count.
CheckRx:    JNB   RxTime.7,RS232RX      ; Is this an active time slice 
                                        ;   for an RS-232 receive?
            JNB   RxOn,T0Ex             ; If receive is active, increment 
            INC   RxTime                ;   the time slice count.

T0Ex:       POP   PSW                   ; Restore status,
            POP   ACC                   ;   and accumulator.

            MOV   P3,Flags              ; For demo purposes, output status 
                                        ;   on an extra port.
            RETI



;*******************************************************************************
;                             RS-232 Transmit Routine
;*******************************************************************************


RS232TX:    JNB   TxCnt.4,TxData        ; Go if data bit.
            JNB   TxCnt.0,TxStop        ; Go if stop bit.


; Send start bit and do buffer housekeeping.

TxStart:    JB    CTS,TxEx1             ; Is CTS asserted (low) so can we send?  
                                        ;   If not, try again after 1 bit time.
            CLR   TxPin                 ; Set start bit.
            MOV   TxShift,TxDat         ; Get byte to transmit  from buffer.
            CLR   TxFull
            MOV   TxCnt,#08h            ; Init bit count for 8 bits of data.
                                        ;   (note: counts UP).

TxEx1:      MOV   TxTime,#TxBitLen      ; Reset time slice count.
            SJMP  CheckRx               ; Restore state and exit.


; Send Next Data Bit.

TxData:     MOV   A,TxShift             ; Get un-transmitted bits.
            RRC   A                     ; Shift next TX bit to carry.
            MOV   TxPin,C               ; Move carry out to the TXD pin.
            MOV   TxShift,A             ; Save bits still to be TX'd.

            INC   TxCnt                 ; Increment TX bit counter
            MOV   TxTime,#TxBitLen      ; Reset time slice count.
            SJMP  CheckRx               ; Restore state and exit.


; Send Stop Bit and Check for More to Send.

TxStop:     SETB  TxPin                 ; Send stop bit.
            JB    TxFull,TxEx2          ; More data to transmit?
            CLR   TxOn                  ; If not, turn off TX active flag, and
            CLR   RTS                   ;   make sure that whoever is on the
                                        ;   other end knows it's OK to send.

            JB    RxOn,TxEx2            ; If receive active, timer stays on,
            CLR   TR                    ;   otherwise turn off timer.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
看电视剧不卡顿的网站| 日韩国产欧美一区二区三区| 91精品免费在线| 91精品国产综合久久香蕉麻豆| 欧美性生活大片视频| 欧美一区三区二区| ww久久中文字幕| 亚洲欧美日韩久久| 亚洲一区二区三区四区在线| 香蕉加勒比综合久久| 久久国产福利国产秒拍| 国产美女在线精品| 一本久久a久久精品亚洲| 欧美日韩成人综合天天影院| 制服.丝袜.亚洲.另类.中文 | 777精品伊人久久久久大香线蕉| 色狠狠色噜噜噜综合网| 欧美精品一区二区久久婷婷| **欧美大码日韩| 麻豆精品蜜桃视频网站| 色婷婷综合久久久久中文| 日韩欧美一区二区免费| 亚洲麻豆国产自偷在线| 国产乱码精品一区二区三区忘忧草 | 日本免费新一区视频| 国产成人综合在线观看| 777欧美精品| 曰韩精品一区二区| 国产成人精品免费一区二区| 欧美三级欧美一级| 国产精品乱码一区二三区小蝌蚪| 人妖欧美一区二区| 91老师国产黑色丝袜在线| 久久久久九九视频| 久久精品国产精品亚洲红杏| 在线看日韩精品电影| 国产精品嫩草影院av蜜臀| 捆绑变态av一区二区三区| 欧美性高清videossexo| 夜夜夜精品看看| 91美女片黄在线观看| 中文字幕亚洲在| 欧美亚洲综合色| 亚洲乱码日产精品bd| 夫妻av一区二区| 亚洲欧洲av色图| 91久久奴性调教| 五月婷婷综合激情| 日韩视频不卡中文| 国产福利视频一区二区三区| 国产亚洲1区2区3区| 91年精品国产| 亚洲成人av一区二区三区| 欧美一区二区三区视频免费播放| 亚洲va韩国va欧美va精品| 欧美一区二区在线看| 免费成人在线影院| 亚洲国产精华液网站w| 91美女视频网站| 午夜视频在线观看一区二区三区 | 欧美国产在线观看| 色激情天天射综合网| 紧缚捆绑精品一区二区| 国产午夜精品久久久久久免费视| 国产精品亚洲午夜一区二区三区| 亚洲三级理论片| 久久一夜天堂av一区二区三区| 国产·精品毛片| 日本不卡一区二区三区| 亚洲三级理论片| 国产亚洲精久久久久久| 欧美日韩高清影院| 成人爱爱电影网址| 激情综合网最新| 蜜臀91精品一区二区三区| 欧美国产日韩精品免费观看| 欧美一区二区在线播放| 在线视频你懂得一区二区三区| 国产成人综合视频| 久久99精品一区二区三区 | 91麻豆文化传媒在线观看| 黑人精品欧美一区二区蜜桃| 免费成人在线观看| 美国一区二区三区在线播放| 亚洲欧美二区三区| 中文子幕无线码一区tr| 国产人久久人人人人爽| 国产校园另类小说区| 国产欧美一区二区精品婷婷| 日韩精品综合一本久道在线视频| 日韩写真欧美这视频| 精品久久久久久久久久久久久久久久久| 欧美三级日韩三级| 5月丁香婷婷综合| 精品美女在线播放| 欧美国产日韩a欧美在线观看 | 韩国女主播一区二区三区| 国产又黄又大久久| 色偷偷88欧美精品久久久| 欧美日韩国产123区| 精品国产自在久精品国产| www激情久久| 一区二区三区在线不卡| 日韩影院免费视频| 国产成人精品免费网站| 色美美综合视频| 日韩一区二区影院| 国产精品毛片久久久久久| 一级精品视频在线观看宜春院| 美女视频免费一区| av亚洲精华国产精华| 日韩欧美亚洲一区二区| 亚洲啪啪综合av一区二区三区| 亚洲va欧美va人人爽午夜| 久久超碰97中文字幕| 欧美在线观看18| 国产日韩欧美不卡| 精品一区二区三区在线观看国产| 色综合久久久久久久久| 久久色在线视频| 捆绑变态av一区二区三区| 欧洲一区在线电影| 欧美韩国一区二区| 国产精品一区二区在线观看不卡| 91精品国产欧美一区二区 | 一本大道av伊人久久综合| 精品少妇一区二区三区在线视频| 一区二区三区四区国产精品| 成人永久免费视频| 亚洲国产精品精华液2区45| 国产精品资源网站| 国产欧美一区二区三区网站| 国精产品一区一区三区mba视频| 欧美人妖巨大在线| 欧美aa在线视频| 精品国产乱码久久| 国产精品 日产精品 欧美精品| 欧美精品一区二区三区在线| 蜜臀av在线播放一区二区三区| 日韩一级免费观看| 久久国产三级精品| 国产精品色噜噜| 91成人免费网站| 国产一区二区三区视频在线播放| 久久综合久久综合久久| 成人av在线网站| 亚洲无人区一区| 日韩女优视频免费观看| 国产精品亚洲专一区二区三区| 久久色.com| 欧美午夜视频网站| 韩国成人福利片在线播放| 国产精品三级在线观看| 欧美一区二区三区在线观看视频| 日韩精品五月天| 亚洲欧洲av另类| 精品国一区二区三区| 色婷婷av一区二区三区大白胸 | 精品国精品国产| 欧美在线综合视频| 成人午夜激情在线| 日本欧美大码aⅴ在线播放| 中文一区二区在线观看| 欧美顶级少妇做爰| 在线观看亚洲专区| av资源站一区| 99视频精品在线| 黄网站免费久久| 美腿丝袜在线亚洲一区 | 99久久综合99久久综合网站| 日本美女一区二区| 日韩—二三区免费观看av| 日韩伦理电影网| 综合激情网...| 亚洲精品免费一二三区| 国产精品成人一区二区三区夜夜夜| 久久综合视频网| 2024国产精品| 国产日韩欧美a| 中文字幕一区三区| 亚洲精品中文在线影院| 亚洲一区二三区| 日本午夜一区二区| 久久精品国内一区二区三区| 青青草97国产精品免费观看无弹窗版| 五月激情丁香一区二区三区| 日韩av在线发布| 国产麻豆精品视频| 99亚偷拍自图区亚洲| 一本一道波多野结衣一区二区| 欧美性猛片aaaaaaa做受| 日韩欧美一区电影| 亚洲欧美日韩国产综合在线| 亚洲3atv精品一区二区三区| 国产主播一区二区三区| 国产成人高清视频| 欧美视频一二三区| 久久久久久综合| 性做久久久久久久免费看| 久久99在线观看|