Java语言在西门子PLC串口通信程序中的应用

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

2009105555MYKJJavaPLC2000921JavaJava。JavaSmalltalkC++、。JavaJava。JavaJavaAPI。Java。2PLCS7-200PLC、PLC。S7-200PLC9RS-485PC/PPISINEC-L2PLC。COMPLC。。3PLCPLCPLCS7-200。1。、、。2S7-200。4JavaJAVAsuncomm.jarwin32com.dlljavax.comm.properties。comm.jarjavaAPIwin32com.dllcomm.jarjavax.comm.properties。1comm.jarJRE_HOME\lib\ext。2win21com.dllRS232user.dir。3javax.comm.propertiesJRE_HOME\lib23]。5JavaCOM1COM2、9600、8、1、、、。1try{CommPortserialPort=portId.openMyApp60/**/InputStreaminput=serialPort.getInputStreaminput.read.../**/OutputStreamoutput=serialPort.getOutputStreamoutput.write...}catchPortInUseExceptionex{...}2publicvoidcommWrite{StringoutString=ioBean.jTextField1.getTextifoutString.equalsclear{ioBean.Receiver.setText\nCOM+portId+Receive}ioBean.jTextField1.setTexttry{outputStream.writeoutString.getBytesoutputStream.writebyte0x0DioBean.Receiver.setText\nCOM+portId++outString}catchIOExceptione{}}3。CommPortIdentifierCommPortclose。publicvoidcommClose{try{inputStream.closeoutputStream.closeserialPort.closeSystem.out.printlnTimeStamp+msg2-SerialPortCOM+por-tId+isclosingioBean.Receiver.append\nCOM+portId+isclosing}catchExceptione{System.out.printlne}}6Java。[1].PC[J].2007.[2][].Java[M].4.20076.PLC。PLC、。Java。Java。S7-200PLCPLC。PLCS7-2001981—。

1 / 1
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功