⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modbuex.htm

📁 串口调试工具 用于串口调 试的很方便
💻 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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>&nbsp; System.out.println(<font
size="2"> </font><font size="3">e.</font>getMessage());</p>

<p><font size="2">}</font></p>

<p>&nbsp;</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 + -