|
下面的程序中 , 單片機將FIFO中的數(shù)據(jù)讀取出來后,從串口發(fā)送出去。 ;*********************************** 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 |