×
嵌入式开发 > 详情

单片机和 FIFO 的接口汇编程序

发布时间:2020-06-29 发布时间:
|
下面的程序中,单片机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


『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
Recogni:将高端AI芯片推向自动驾驶边缘