📄 modbuex.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<title>Java Modbus Exception </title>
</head>
<body>
<p><font size="5"><strong>Java ModbusException Class Members </strong></font></p>
<p><strong>public class ModbusException extends RuntimeException</strong></p>
<p>A ModbusException object represents an exception condition related to a communication
operation whith modbus slave device. These exceptions include communications exceptions
and modbus functions exceptions, for instance , if you try to preset a register and the
address is invalid, the modbus slave return a message indicating this invalid operation.</p>
<p>You do not need to create objects of this class, this creation is intended to be made
inside <a href="javaci.htm">Modbus</a> class.</p>
<p><strong>Constructor</strong> </p>
<p><strong>public ModbusException(String s, int iErrorNumber)</strong></p>
<p>parameters </p>
<p>s - String with error Description.</p>
<p>iErrorNumber - Error number.</p>
<p><strong>example</strong></p>
<p><font size="2">objModbus.ThrowException(true);</font></p>
<p><font size="2">try {</font></p>
<blockquote>
<p><font size="2">//It's not needed to verify each call for errors</font></p>
<p><font size="2">objModbus.ForceSingleCoil((short)17,172,true) ; //force coil 173 ON in
slave device 17<br>
objModbus.PresetSingleRegister((short)17,1,3) ; //preset register 40002 to 03 in slave
device 17 </font></p>
</blockquote>
<p><font size="2">}</font></p>
<p><font size="2">catch(</font>ModbusException<font size="2"> </font><font size="3">e</font><font
size="2">) {</font></p>
<p><font size="2"> </font> System.out.println(<font
size="2"> </font><font size="3">e.</font>getMessage());</p>
<p><font size="2">}</font></p>
<p> </p>
<p><strong>See also:</strong> <strong>RuntimeException</strong> in Java help files.</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -