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

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

?? soft_uart.asm

?? 常用子程序-61個-4.2M.rar
?? 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一区二区三区免费野_久草精品视频
欧美不卡一区二区| 欧美手机在线视频| 亚洲成a人片在线观看中文| 国产精品―色哟哟| 国产欧美一区二区精品婷婷| 欧美电视剧在线观看完整版| 精品国产91久久久久久久妲己| 日韩一区二区三区视频| 精品三级在线看| 亚洲精品在线免费观看视频| 日韩欧美高清一区| 久久只精品国产| 欧美极品aⅴ影院| 一区二区在线观看视频| 五月激情综合网| 美女久久久精品| 国产精品亚洲专一区二区三区| 粉嫩欧美一区二区三区高清影视| 国产成人8x视频一区二区| 成人免费看黄yyy456| 色综合久久久久综合| 欧美日韩国产一级二级| 欧美精品18+| 精品国产一区二区三区久久影院 | 久久久久久久久久久久电影| 久久久蜜桃精品| 国产精品久久福利| 亚洲一级二级三级| 狠狠色2019综合网| 99久久综合色| 91麻豆精品国产自产在线观看一区| 欧美变态口味重另类| 亚洲区小说区图片区qvod| 免费视频最近日韩| 91小视频免费看| 91精品国产91久久久久久一区二区 | 五月婷婷欧美视频| 国产成人av电影在线观看| 色综合久久久久| 欧美成人国产一区二区| 亚洲最新在线观看| 国产一区二区免费看| 在线日韩av片| 中文字幕的久久| 五月天精品一区二区三区| 国产凹凸在线观看一区二区| 欧美日韩在线不卡| 国产欧美精品一区| 奇米综合一区二区三区精品视频| 国产经典欧美精品| 欧美一区二区三区视频在线 | 91免费看片在线观看| 欧美一区二区三区四区视频| 亚洲视频免费在线观看| 国产一区二区三区四区五区美女| 欧美午夜精品一区二区蜜桃 | 欧美主播一区二区三区| 国产欧美日韩视频一区二区| 日韩和欧美一区二区三区| 色婷婷综合久久久久中文一区二区| 欧美精品一区二区三区四区| 亚洲成a人在线观看| 色成年激情久久综合| 国产精品久久久久久久裸模| 国产一区二区三区四区在线观看 | 一本到一区二区三区| 国产免费久久精品| 国产精品伊人色| 久久综合色8888| 蜜桃一区二区三区在线| 在线播放日韩导航| 亚洲成人av免费| 91麻豆精品在线观看| 国产精品电影一区二区| 99在线视频精品| 国产精品不卡视频| www.亚洲在线| 国产精品久久久久婷婷| 波多野结衣中文字幕一区 | 色综合天天综合在线视频| 久久久99久久| 高清视频一区二区| 国产精品美女久久久久久2018| 成人性生交大片免费看中文| 久久精品亚洲精品国产欧美| 国产999精品久久久久久| 亚洲国产激情av| 在线观看国产日韩| 青娱乐精品视频| 久久综合九色综合欧美就去吻| 国产精品一二三四五| 国产精品视频一区二区三区不卡| 成人一区在线观看| 亚洲精品综合在线| 欧美日本一道本在线视频| 免费观看久久久4p| 国产目拍亚洲精品99久久精品| 99这里只有久久精品视频| 亚洲国产精品一区二区久久恐怖片 | 亚洲综合免费观看高清在线观看| 欧美视频日韩视频| 极品少妇xxxx精品少妇偷拍| 国产女主播一区| 欧美羞羞免费网站| 老司机精品视频线观看86| 国产亚洲福利社区一区| 99国产精品国产精品久久| 亚洲国产精品久久人人爱蜜臀 | av在线播放不卡| 亚欧色一区w666天堂| 久久色在线视频| 日本韩国欧美国产| 九九在线精品视频| 一区二区三区蜜桃网| 精品国产髙清在线看国产毛片| 一本大道久久精品懂色aⅴ| 日韩一区精品视频| 中文字幕一区日韩精品欧美| 欧美丰满嫩嫩电影| 91小视频在线免费看| 国产乱子轮精品视频| 亚洲在线观看免费视频| 国产欧美一区二区精品忘忧草 | 在线国产电影不卡| 国产酒店精品激情| 蜜桃视频一区二区三区| 亚洲精品久久久蜜桃| 国产视频不卡一区| 日韩欧美资源站| 91黄色在线观看| 成人精品视频网站| 国产一区二区不卡在线| 视频一区视频二区中文| 亚洲精品少妇30p| 久久亚洲影视婷婷| 日韩女优电影在线观看| 欧美三级一区二区| 91精品福利视频| 成人国产电影网| 国产精品一级黄| 国产呦萝稀缺另类资源| 秋霞电影网一区二区| 亚洲高清免费观看高清完整版在线观看| 国产欧美日韩激情| 亚洲国产精品成人综合| 国产亚洲欧美日韩俺去了| 精品欧美一区二区久久| 91精品国产综合久久婷婷香蕉 | 国产二区国产一区在线观看| 日韩成人免费看| 视频一区二区三区在线| 亚洲福利视频一区二区| 亚洲一区在线看| 亚洲一区二区黄色| 亚洲第一搞黄网站| 丝袜美腿亚洲一区二区图片| 亚洲高清免费视频| 亚洲h精品动漫在线观看| 一区二区三区精品视频| 亚洲综合在线电影| 亚洲va国产天堂va久久en| 亚洲一级二级在线| 日韩高清不卡一区二区三区| 日韩国产精品91| 麻豆一区二区三| 国内不卡的二区三区中文字幕| 九九视频精品免费| jlzzjlzz亚洲女人18| 91香蕉视频污在线| 欧美色图激情小说| 911精品国产一区二区在线| 欧美一级片在线看| 久久色在线视频| 亚洲青青青在线视频| 香蕉成人啪国产精品视频综合网| 日本三级亚洲精品| 激情综合亚洲精品| 99re这里都是精品| 欧美日韩不卡一区| 欧美精品一区二区在线观看| 亚洲欧洲日韩综合一区二区| 亚洲观看高清完整版在线观看| 麻豆中文一区二区| 99视频一区二区| 日韩欧美黄色影院| 国产精品青草久久| 香蕉av福利精品导航| 国产麻豆精品一区二区| 在线观看91视频| 精品成人佐山爱一区二区| 国产欧美日韩不卡免费| 亚洲风情在线资源站| 国产美女精品一区二区三区| 色女孩综合影院| 日韩欧美在线123| 国产精品国产三级国产a| 免费的国产精品| 色综合久久中文综合久久97| 欧美精品一区二区三区很污很色的 | 色狠狠av一区二区三区|