单片机和 FIFO 的接口汇编程序
2013-03-23
标签:

下面的程序中,单片机将FIFO中的数据读取出来后,从串口发送出去。


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


        ef bit p3.3    ;fifo empty flag
        rst bit p3.5   ;reset fifo
        read bit p3.7  ;read fifo
        org 0000h
        ljmp main
        org 0030h
main:   
;------ initial timer


        mov tmod,#00100001b    ;timer0 mode 1 (16 bit)
;timer1 mode 2 (8 bit auto reload)


        mov a,pcon
        orl a,#10000000b
        mov pcon,a     ;setb SMOD bit
        mov th1,#0fdh  ;19200ps @ 11.0592Mhz OSC
        setb tr1       ;turn on timer1
;------ initial serial communication port


        mov scon,#01010000b    ;mode 1 (8 bit UART,variable Baud)
        clr ti
        setb read
        clr rst
        nop
        setb rst       ;reset fifo
start:  
        jnb ef,$       ;if no data then wait
        clr read
        nop
        mov a,p1
        nop
        setb read      ;read data from fifo
        jnb ti,$       ;send data
        clr ti
        mov sbuf,a
        ajmp start
        end


可能会用到的工具/仪表
相关文章
推荐文章
热门文章
章节目录
本站简介 | 意见建议 | 免责声明 | 版权声明 | 联系我们
CopyRight@2024-2039 嵌入式资源网
蜀ICP备2021025729号