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

正文內(nèi)容

pc機(jī)與單片機(jī)的通訊設(shè)計(jì)(文件)

 

【正文】 42 頁(yè) void _interrupt _far int_ser1( void ) { _xfer = 1。 } void _interrupt _far int_ser_sup( void ) { char val。 c = _xfer。 0x04 ) /* Receive Interrupt */ { 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 33 頁(yè) 共 42 頁(yè) ptr = cin_head。 cin_head = ptr。 0x02 ) /* Transmit Interrupt */ { if( (!cout_full) amp。 val amp。 /* RX interrupts ON */ } else { outp(SREG(THR), cout_buf[cout_tail++])。 } } ( 4) MCS51 串行通訊: MCS51 的串行口使用起來(lái)非常簡(jiǎn)單,因?yàn)?MCS51 單片機(jī)的串行口沒(méi)有與MODEM 控制相關(guān)的信號(hào)。 unsigned char getch(void)。 TH1 = 0xfd。 RI = 0。 TI = 0。 return(SBUF)。 /* receiver tail index */ unsigned char RR_cLev。 /* transmitter tail index */ unsigned char TR_cLev。 /* serial flag */ bit FlagTransIdle。 /* convert ining CR to LF */ unsigned char TestBits。 int putch(int)。 int SerFlushIn()。 FlagCvtInCR = 1。 /* set up Timer 1 to produce serial rate */ TCON amp。= 0x0F。 TH1 = TL1 = T1RELOAD amp。 /* enable serial interrupts */ } 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 38 頁(yè) 共 42 頁(yè) /**/ /* Serial console interrupt handler */ /* If transmitter output is disabled, we fake trans interrupts until empty */ void SerInt() interrupt 4 { if(RI) { /* receiver interrupt active? */ if(RR_cLevINRINGSIZE) { /* room for newest char? */ RRing[RR_iHead] = SBUF。 /* hit end of array yet? */ } RI = 0。 /* tick the index */ if(TR_iTail==OUTRINGSIZE) TR_iTail = 0。 /* if not LF, handle normally */ if(TransChar==39。)。 /* point to char slot */ TR_iHead++。 if(FlagTransIdle) { FlagTransIdle = 0。 } /**/ /* Decide if there are any pending chars */ /* Returns nonzero if there39。 /* wait for ring empty */ while(!FlagTransIdle)。 RR_cLev = 0。 ES = 0。) RetVal = 39。 counter */ RR_cLev。 return(RetVal)。 /* continue... */ } } 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 42 頁(yè) 共 42 頁(yè) 使用查詢的程序可以做到多高的波特率取決于主程序的工作量,使用中斷方式的通訊驅(qū)動(dòng)程序在使用 的速率。 RS485 的發(fā)送控制 端僅在需要發(fā)送時(shí)打開(kāi),平時(shí)應(yīng)關(guān)端發(fā)送器,因?yàn)樵谕?RS485網(wǎng)絡(luò)中在同一時(shí)刻僅允許一個(gè)發(fā)送器工作。這些調(diào)件既可使用查詢的方法得到,也可以在中斷程序中實(shí)現(xiàn)。這一方法非常適合中斷方式,尤其是以數(shù)據(jù)包傳送的 RS485 通訊。因此,當(dāng)自己發(fā)送的數(shù)據(jù)完全被自己接收回來(lái)時(shí)即可關(guān)閉發(fā)送器。這可以通過(guò)以下兩種方法實(shí)現(xiàn)。在同一個(gè) RS485 網(wǎng)絡(luò)中,可以多達(dá) 32 個(gè)模塊,某些器件可以多達(dá) 256 個(gè)甚至更多。 */ /* The ?putstr entry point has *pString in DPTR */ int putstr (char *pstring) { while(*pstring) { /* fetch character if zero done */ putch(*pstring)。 /* hit end of array yet? */ } else RetVal = 1。 /* use LF instead of CR */ RR_iTail++。 if(RetVal==39。 /* turn on serial interrupts */ } /**/ /* Get character from console */ /* CRs turn into LFs unless we39。 /* turn off serial interrupts */ RR_iTail = 0。 /* tack on current level */ } /**/ /* Wait for the serial transmitter to go idle */ /* If the transmitter is disabled, that39。 } ES = 1。 index */ TR_cLev++。 /* wait for space in ring */ ES = 0。) putc(39。/* no, flag inactive */ TI = 0。 /* fetch next char and send it */ TR_cLev。 /* tick the index */ RR_cLev++。 /* flush existing Timer 1 setup */ TR1 = 1。 /* flush existing Timer 1 setup */ SCON = 0x50。 /* clear run amp。 TR_iHead = TR_iTail = TR_cLev = TR_cMax = 0。 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 37 頁(yè) 共 42 頁(yè) /* serial I/O code */ /**/ /* Initialize serial port hardware and variables */ include include void SerInitialize() { SerFlags = 0。 int getch()。 /* receiver ring buffer */ unsigned char xdata TRing[OUTRINGSIZE]。 /* don39。 /* transmitter buffer count */ 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 36 頁(yè) 共 42 頁(yè) unsigned char UnGotCh。 /* receiver buffer count */ unsigned char TR_iHead。 返回頁(yè)首 unsigned char RR_iHead。 } unsigned char getch(void) { while(!RI)。 putch(ch)。 TR1 = 1。 SCON = 0x50。使用查詢方式時(shí),僅需初始化有關(guān)的寄存器即可。 } } else return。 outp(SREG(LCR),val)。 (cout_head == cout_tail) ) { cout_mt = TRUE。 if( ch == CR ) /* Count lines */ cin_crt++。 if( cin_mt || ptr != cin_tail ) { cin_buf[ptr++] = ch。 /* Read and discard STATUS */ val = inp( SREG(IIR) )。 int ptr。 } void _interrupt _far int_ser2( void ) { _xfer = 2。 _enable()。 outp(SREG(IER),0)。 val = inp( SREG(RBR) )。 val = inp( SREG(LCR) )。 _disable()。 DTR */ _enable()。 /* 01111111B */ outp( SREG(LCR),val )。 /* Read and discard STATUS */ val = inp( SREG(RBR) )。 val amp。 _dos_setvect(cint_number,int_ser2)。 cint_number = COM2_INT_NUM。 case 1: /* Here set up for COM1 */ cready = TRUE。 1 = c。 cirq_mask = COM1_IRQ_MASK。 cout_head = 0。 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 ) 第 29 頁(yè) 共 42 頁(yè) cout_buf = obuf。 cin_mt = TRUE。 break。 for( i=0。 } COM *ser_init0(int port,char *ibuf,int isize, char *obuf,int osize) { int i。 中國(guó)最龐大的下資料庫(kù) (整理 . 版權(quán)歸原作者所有 )
點(diǎn)擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1