Proteus 51串口與虛擬終端通訊。

來源:互聯網
上載者:User

1.電路圖

 baud rate of virtual terminal should be 4800

 

2。當使用者輸入0時,顯示hi,dave,

     當使用者輸入1時,顯示hi,mike

     輸入其他時,    顯示input error.

 

3. 源碼

;latest revise:2009-12-10

;by:alex shoal

;email:alex.shoal@gmail.com

ORG0000H

START:MOVSP,#60H

MOVSCON,#01010000B

;MOVP1,00H

MOVTMOD,#20H

ORLPCON,#10000000B

MOVTH1,#0F3H

MOVTL1,#0F3H

SETBTR1

LOOP:JNBRI,$

CLRRI

MOVA,SBUF

CJNEA,#30H,B1

CALLMSG1

 

B1:CJNEA,#31H,B2

CALLMSG2

 

B2:CALLMSG3

 

MSG1:MOVDPTR,#M1

CALLPRINT

SJMPLOOP

MSG2:MOVDPTR,#M2

CALLPRINT

SJMPLOOP

 

MSG3:MOVDPTR,#M3

CALLPRINT

SJMPLOOP

 

PRINT:MOVR0,#00H

DP1:        MOVA,R0

MOVCA,@A+DPTR

CJNEA,#00H,OUTPUT

RET

OUTPUT:MOVSBUF,A

JNBTI,$

CLRTI

INCR0

SJMPDP1

 

 

M1:DB 'Hi,Dave',0DH,00H

M2:DB 'Hi,Mike',0DH,00H

M3:DB 'Input Error',0DH,00H

       END

 

3。結果

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.