亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
97精品国产露脸对白| 午夜久久久影院| 国产ts人妖一区二区| 久久久久久97三级| 国产精品1024久久| 国产精品久久久久aaaa樱花 | 3d动漫精品啪啪1区2区免费 | 日本美女视频一区二区| 3d动漫精品啪啪1区2区免费| 久久99精品国产麻豆婷婷| 精品日韩一区二区三区| 国产成人在线免费| 亚洲欧洲三级电影| 欧洲一区二区av| 五月天婷婷综合| 日韩三级免费观看| 成人激情av网| 一区二区三区国产| 日韩一级二级三级精品视频| 国产精品亚洲一区二区三区在线| 中文字幕+乱码+中文字幕一区| 91社区在线播放| 婷婷综合久久一区二区三区| 日韩欧美的一区二区| 国产成人啪午夜精品网站男同| 亚洲桃色在线一区| 欧美高清视频不卡网| 老色鬼精品视频在线观看播放| 欧美高清在线一区二区| 欧美亚洲丝袜传媒另类| 精品在线亚洲视频| 中文字幕一区二区三区蜜月| 欧美精品色一区二区三区| 国产一区二区三区免费在线观看 | 91麻豆精品国产91久久久久久久久| 美日韩黄色大片| 国产精品久久毛片a| 欧美色图在线观看| 国产二区国产一区在线观看| 亚洲在线免费播放| 久久久久久久久久看片| 欧美专区亚洲专区| 国产69精品一区二区亚洲孕妇| 亚洲理论在线观看| 国产人伦精品一区二区| 欧美日韩国产片| 成人av资源下载| 老司机精品视频导航| 亚洲大片精品永久免费| 国产精品美女一区二区| 欧美哺乳videos| 欧美日韩高清在线播放| 99riav一区二区三区| 久久精品国产精品青草| 亚洲国产日韩综合久久精品| 国产精品天天摸av网| 日韩三级免费观看| 精品婷婷伊人一区三区三| 成人a免费在线看| 国产又黄又大久久| 看电影不卡的网站| 日本不卡视频一二三区| 亚洲一区二区三区美女| 亚洲欧美区自拍先锋| 国产女主播视频一区二区| 日韩免费电影网站| 91精品国产入口| 精品视频一区三区九区| 91成人免费网站| 91蝌蚪porny成人天涯| 岛国一区二区在线观看| 国产伦理精品不卡| 国产在线视频一区二区三区| 免费在线观看一区| 蜜桃视频第一区免费观看| 日本欧美在线观看| 午夜av一区二区| 丝袜亚洲另类欧美综合| 五月婷婷激情综合网| 天天操天天干天天综合网| 午夜精品久久久久久久99水蜜桃| 一级做a爱片久久| 亚洲自拍欧美精品| 亚洲午夜久久久久久久久久久| 亚洲一区在线观看免费观看电影高清| 成人欧美一区二区三区小说| 国产精品灌醉下药二区| 国产精品成人一区二区艾草 | 日韩影视精彩在线| 日韩**一区毛片| 另类的小说在线视频另类成人小视频在线| 日本成人在线一区| 美女一区二区三区在线观看| 久久99国产乱子伦精品免费| 狠狠色丁香婷婷综合| 国产精品一区三区| 成人黄色电影在线| 欧美亚洲国产bt| 欧美一区二区三区四区视频| 欧美mv日韩mv国产网站app| 久久综合久色欧美综合狠狠| 国产日韩精品视频一区| 国产精品福利一区| 亚洲大片在线观看| 精品一区二区三区欧美| 成人黄页在线观看| 91高清视频在线| 日韩亚洲欧美一区二区三区| 精品国产一区二区三区四区四| 精品国产乱码久久久久久久| 国产精品乱码久久久久久| 亚洲乱码精品一二三四区日韩在线| 亚洲一区二区在线观看视频| 免费xxxx性欧美18vr| 高清在线成人网| 欧美亚洲日本国产| 精品国产污污免费网站入口 | 精品一区二区免费在线观看| 国产69精品久久777的优势| 91成人国产精品| 精品国产免费久久| 亚洲精品国产无天堂网2021| 免费在线看一区| 色综合久久久久综合99| 日韩三级.com| 亚洲精品综合在线| 国产美女在线精品| 欧美日韩免费高清一区色橹橹| 久久综合久久99| 亚洲国产欧美在线| 高清不卡一二三区| 91精品国模一区二区三区| 久久久综合九色合综国产精品| 亚洲日本电影在线| 国产一区欧美日韩| 欧美精品久久天天躁| 中文字幕在线不卡视频| 精品一区二区在线看| 欧美午夜寂寞影院| 国产精品免费aⅴ片在线观看| 免费xxxx性欧美18vr| av欧美精品.com| 2欧美一区二区三区在线观看视频| 一区二区三区在线观看网站| 国产精品综合在线视频| 91精品国产综合久久精品| 亚洲欧美日韩国产综合| 成人av电影在线播放| 精品粉嫩aⅴ一区二区三区四区| 亚洲一区视频在线| 色婷婷精品久久二区二区蜜臀av | 日韩亚洲欧美一区二区三区| 亚洲国产va精品久久久不卡综合| 国产成人免费视频一区| 欧美一级日韩免费不卡| 亚洲国产色一区| 欧美性猛交xxxxxx富婆| 亚洲欧美视频一区| 成人免费高清视频在线观看| 久久久久国产精品麻豆ai换脸| 日本亚洲天堂网| 91精品国产综合久久久蜜臀粉嫩 | 青青国产91久久久久久| 欧美性大战xxxxx久久久| 日韩理论片中文av| 99精品视频在线观看| 亚洲欧洲性图库| 色综合天天综合网天天看片| 国产精品剧情在线亚洲| yourporn久久国产精品| 中文字幕不卡在线观看| 国产成人精品一区二| 中文av字幕一区| 成人av先锋影音| 国产精品久久久久久久久晋中| 成人三级在线视频| 国产精品免费免费| 91美女在线观看| 亚洲激情图片小说视频| 91国偷自产一区二区开放时间 | 欧美va亚洲va在线观看蝴蝶网| 日本不卡一区二区三区| 欧美一区二区三区在线电影| 日韩精品电影在线观看| 欧美大肚乱孕交hd孕妇| 国产乱码精品1区2区3区| 国产网站一区二区| av中文一区二区三区| 亚洲色图一区二区| 欧美日韩免费不卡视频一区二区三区| 日本成人在线看| 国产亚洲欧美日韩日本| 不卡电影一区二区三区| 亚洲综合丝袜美腿| 91精品国产一区二区三区香蕉| 国产一区欧美一区| 亚洲免费看黄网站| 日韩一区二区在线播放| 国产成人免费在线视频| 亚洲国产日韩在线一区模特|