freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

pc機(jī)與單片機(jī)的通訊設(shè)計(jì)-wenkub.com

2025-07-09 20:21 本頁(yè)面
   

【正文】 原則上說(shuō),這一方法無(wú)論是查詢(xún)或中斷方 式都適用,但實(shí)際上,由于 RS485 的數(shù)據(jù)通常打包后發(fā)送,因此,使用查詢(xún)的方法并不理想。 一、在數(shù)據(jù)完全移出后,對(duì)于 PC 機(jī)為發(fā)送移位寄存器空,對(duì)于 MCS51 為 TI置位。相應(yīng)的, RS485具有接收 /發(fā)送控制端, RS485 的接收控制端可以在需要接收的時(shí)候打開(kāi)或者一直打開(kāi)以便無(wú)條件的接收線路上的數(shù)據(jù)。 pstring++。 ES = 1。 /* tick size index amp。\r39。re not doing that... */ 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 41 頁(yè) 共 42 頁(yè) int getch() { int RetVal。 /* reset ring variables */ RR_iHead = 0。s considered to be the same thing */ void SerWaitOutDone() { while (TR_cLev)。 return(TransChar)。 if(TR_iHead==OUTRINGSIZE) TR_iHead = 0。 TRing[TR_iHead] = TransChar。\r39。 /* indicate done with it */ } } /**/ /* Send character to console */ 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 39 頁(yè) 共 42 頁(yè) /* Can strip LFs, in which case you get CR instead of LF/CR */ int putch(int TransChar) { putc(TransChar)。 /* tick size counter */ TR_iTail++。 /* tick size counter */ if(RR_iHead==INRINGSIZE) RR_iHead = 0。 /* start the timer */ ES = 1。 /* flush existing Timer 1 setup */ PCON |= 0x00。 interrupt flags */ TMOD amp。 UnGotCh = 1。 FlagTransIdle = 1。 void SerWaitOutDone()。 /* receiver ring buffer */ int putstr (const char *)。t send linefeeds */ bit FlagCvtInCR。 /* saved char for ungetch() */ unsigned char SerFlags。 /* transmitter head index */ unsigned char TR_iTail。 /* receiver head index */ unsigned char RR_iTail。 RI = 0。 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 35 頁(yè) 共 42 頁(yè) } } void putch(unsigned char ch) { SBUF = ch。 TI = 1。 TMOD |= 0x20。演示程序如下: include include void putch(unsigned char)。 /* No Interrupt */ 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 34 頁(yè) 共 42 頁(yè) } outp(INTC_EOI,cirq_eoi)。 outp(SREG(IER),0x01)。 val = inp( SREG(LCR) )。 } } else { if( val amp。 if( ptr == cin_size ) ptr = 0。 /* Get interrupt status register */ if( val amp。 COM *c。 _chain_intr( int_ser_sup )。 cready = FALSE。 /* Disable 8250 Interrupts */ outp(SREG(MCR),0)。 val = inp( SREG(LSR))。 /* Reset DLAB for IER access */ val amp。 val = inp(INTC_MASK)。 return( c )。 outp( SREG(IER),1)。 /* Read and discard DATA */ val = inp( SREG(LCR) )。= cirq_mask。 break。 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 30 頁(yè) 共 42 頁(yè) _disable()。 c_base = COM2_BASE。 cold = _dos_getvect( cint_number )。 cirq_eoi = COM1_IRQ_EOI。 cout_tail = 0。 cout_size = osize。 cin_head = 0。 } } if( i == MAX_PORTS ) /* Not found */ return( NULL )。 iMAX_PORTS。 char val。 else val amp。 } void tl_rts( int flag, COM *c ) { char val。 if( flag ) val |= 1。 _enable()。 cin_head = 0。s */ cin_crt。 cin_buf[cin_tail++]。 if( !cready ) return(FALSE)。 } char serhit( COM *c ) { if( !cready ) return(FALSE)。 /* Interrupts OFF NOW */ outp(SREG(IER),0x03)。 val = inp( SREG(IER) )。 val = inp( SREG(LCR) )。 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 25 頁(yè) 共 42 頁(yè) if( cout_head == cout_size ) cout_head = 0。 while( !cout_mt amp。 i++ ) { while( !putser( str[i],c ) )。 } int putsers( char *str, COM *c ) { int n,i,j。 break。\039。 while( ilen ) { while( !serhit(c) ) { if(kbhit()) return( 1 )。 else return( FALSE )。 free( cin_buf )。 return( c )。 out_buf = malloc( osize )。 char *in_buf,*out_buf。 /* Int rtn for serial I/O COM 2 */ void (_interrupt _far int_ser_sup)( void )。 /* Transfer interrupt data structure */ COM *ser_init0(int port,char *ibuf,int isize, char *obuf,int osize)。 static COM _list[MAX_PORTS]。 void tl_rts(int flag,COM *c)。 char serline( COM *c )。 COM *ser_init( int port,int baud,int bit,int parity,int isize,int osize )。 /* Output buffer HEAD ptr */ int out_size。 /* Input CR count */ char in_mt。 /* Input buffer */ int in_tail。 /* IRQ Enable Mask */ char irq_eoi。 putser(ch,c)。 c = ser_init( PORT_B,BAUD_9600,_COM_CHR8,_COM_NOPARITY,4096,4096 )。 else return(1)。 status = inportb(PortBase+5)。0x01) inportb(PortBase+0)。 _putch(ch)。) putch(39。= 0xff。 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 16 頁(yè) 共 42 頁(yè) outportb(PortBase + 3 , 0x03)。 outportb(PortBase + 1 , 0)。 ( 2) 使用查詢(xún)方法的串行通訊程序設(shè)計(jì): include include include define PortBase 0x2F8 void _putch(unsigned char)。 Bit0 置位為 1 表示接收數(shù)據(jù)就緒。 MODEM控制寄存器( MCR): 位 注 釋 Bit7 未使用 Bit6 未使用 Bit5 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 13 頁(yè) 共 42 頁(yè) 自動(dòng)流量控制(僅 16750) Bit4 環(huán)路測(cè)試 Bit3 輔助輸出 2 Bit2 輔助輸出 1 Bit1 設(shè)置 RTS Bit0 設(shè)置 DSR MCR 寄存器可讀可寫(xiě), Bit4=1進(jìn)入環(huán)路測(cè)試模式。 Bit6 置 1 會(huì)將發(fā)送端置為 0,這將會(huì)使接收端產(chǎn)生一個(gè) “間斷 ”。 Bit1:2 可自行復(fù)位,因此無(wú)需使用軟件對(duì)其清零。 Bit0 用來(lái)指示是否有中斷發(fā)生, Bit1:2標(biāo)識(shí)具體的中斷類(lèi)型,這些中斷具有不同的優(yōu)先級(jí)別,其中 LSR 中斷級(jí)別最高,其次是數(shù)據(jù)就緒中斷,然后是發(fā)送寄存器 空中斷,而 MSR 中斷級(jí)別最低。 在上表中, 8250 共有 12 個(gè)寄存器,使用了 8 個(gè)地址,其中部分寄存器共用一個(gè)地址,由 DLAB=0/1 來(lái)區(qū)分,在 DLAB=1 用于設(shè)定通訊所需的波特率。該插座的信號(hào)定義如下: DB25 DB9 信號(hào)名稱(chēng) 方向 含 義 2 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 2 頁(yè) 共 42 頁(yè) 3 TXD 輸出 數(shù)據(jù)發(fā)送端 3 2 RXD 輸入 數(shù)據(jù)接收端 4 7 RTS 輸出 請(qǐng)求發(fā)送(計(jì)算機(jī)要求發(fā)送數(shù)據(jù)) 5 8 CTS
點(diǎn)擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1