首先講接線,要觸發(fā)CTS等引腳的事件,必須對(duì)CTS等引腳施加一個(gè)高電平。高電平的來(lái)源可以來(lái)自第四腳,同時(shí)必須在軟件中對(duì)第四腳置高電平。
發(fā)展壯大離不開(kāi)廣大客戶長(zhǎng)期以來(lái)的信賴(lài)與支持,我們將始終秉承“誠(chéng)信為本、服務(wù)至上”的服務(wù)理念,堅(jiān)持“二合一”的優(yōu)良服務(wù)模式,真誠(chéng)服務(wù)每家企業(yè),認(rèn)真做好每個(gè)細(xì)節(jié),不斷完善自我,成就企業(yè),實(shí)現(xiàn)共贏。行業(yè)涉及酒店設(shè)計(jì)等,在網(wǎng)站建設(shè)、成都全網(wǎng)營(yíng)銷(xiāo)、WAP手機(jī)網(wǎng)站、VI設(shè)計(jì)、軟件開(kāi)發(fā)等項(xiàng)目上具有豐富的設(shè)計(jì)經(jīng)驗(yàn)。C#部分代碼如下
mSP.PortName = "COM1"; mSP.BaudRate = 9600; mSP.DtrEnable = true; //這里是對(duì)DTR置高電平 mSP.RtsEnable = true; //這里是對(duì)RTS置高電平 mSP.Open(); mSP.PinChanged += mSP_PinChanged; int mSPPinCount = 0; StringBuilder mSB = new StringBuilder(); System.DateTime mDTPinLast = System.DateTime.Now; void mSP_PinChanged(object sender, System.IO.Ports.SerialPinChangedEventArgs e) { if (((System.TimeSpan)(System.DateTime.Now - mDTPinLast)).TotalMilliseconds < HealthyExamination.Common.BaseC.GlobeValues.LocalParas.CaptureSerialPortPinDelayMS) { return; } mDTPinLast = System.DateTime.Now; mSPPinCount++; //引腳 簡(jiǎn)寫(xiě) 功能說(shuō)明 //1 CD 載波偵測(cè)(Carrier Detect) //2 RXD 接收數(shù)據(jù)(Receive) //3 TXD 發(fā)送數(shù)據(jù)(Transmit) //4 DTR 數(shù)據(jù)終端準(zhǔn)備(Data Terminal Ready) //5 GND 地線(Ground) //6 DSR 數(shù)據(jù)準(zhǔn)備好(Data Set Ready) //7 RTS 請(qǐng)求發(fā)送(Request To Send) //8 CTS 清除發(fā)送(Clear To Send) //9 RI 振鈴指示(Ring Indicator) if (e.EventType == System.IO.Ports.SerialPinChange.CtsChanged) //引腳8 { mSB.Insert(0, System.DateTime.Now.ToString("mm:ss:ffff") + "\t" + "CtsChanged mSPPinCount=" + mSPPinCount.ToString() + "\r\n"); } else if (e.EventType == System.IO.Ports.SerialPinChange.CDChanged) //引腳1? { mSB.Insert(0, System.DateTime.Now.ToString("mm:ss:ffff") + "\t" + "CDChanged mSPPinCount=" + mSPPinCount.ToString() + "\r\n"); } else if (e.EventType == System.IO.Ports.SerialPinChange.DsrChanged) //引腳6 { mSB.Insert(0, System.DateTime.Now.ToString("mm:ss:ffff") + "\t" + "DsrChanged mSPPinCount=" + mSPPinCount.ToString() + "\r\n"); } else if (e.EventType == System.IO.Ports.SerialPinChange.Ring) //引腳9 { mSB.Insert(0, System.DateTime.Now.ToString("mm:ss:ffff") + "\t" + "Ring mSPPinCount=" + mSPPinCount.ToString() + "\r\n"); } else if (e.EventType == System.IO.Ports.SerialPinChange.Break) //引腳 { mSB.Insert(0, System.DateTime.Now.ToString("mm:ss:ffff") + "\t" + "Break mSPPinCount=" + mSPPinCount.ToString() + "\r\n"); } else { mSB.Insert(0, System.DateTime.Now.ToString("mm:ss:ffff") + "\t" + "Others mSPPinCount=" + mSPPinCount.ToString() + "\r\n"); } }
創(chuàng)新互聯(lián)www.cdcxhl.cn,專(zhuān)業(yè)提供香港、美國(guó)云服務(wù)器,動(dòng)態(tài)BGP最優(yōu)骨干路由自動(dòng)選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡(luò)助力業(yè)務(wù)部署。公司持有工信部辦法的idc、isp許可證, 機(jī)房獨(dú)有T級(jí)流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確進(jìn)行流量調(diào)度,確保服務(wù)器高可用性。佳節(jié)活動(dòng)現(xiàn)已開(kāi)啟,新人活動(dòng)云服務(wù)器買(mǎi)多久送多久。