Protocols and Drivers

Started by til at 07-28-2008 10:49 AM. Topic has 0 replies.

Print Search
Sort Posts:    
   07-28-2008, 10:49 AM
til is not online. Last active: 5/16/2007 7:39:08 PM til

Top 50 Posts
Joined on 05-16-2007
Posts 5
Bug in the Modbus/Serial Integration Kit for ioControl?
I’ve come across what I believe is a bug in the Modbus/Serial Integration Kit for ioControl (IOP-INT-MBSER).
It seems to me that some parentheses need to be added for proper operation.

The zip file is “ModbusSerialv7.1.zip version R1.0 last Update 2/5/200.”
The Powerup chart shows it to be “V1.4 ModbusSerial of 02/01/2008.”
The chart containing the bug is entitled “ModbusSerial V1.0 8/14/2006” the tab is “MBSlaveSerial.”
The block is number 35 -- “Receive CHR.”

With the excellent help of Opto 22 Customer Service Representative Bryce Nakatani, the proper syntax and operation of the OptoScript commands and operands were verified.

The most dangerous aspect of this error is that the CRC check will never fail.

The following downloaded code snippit will illustrate:

NumberToFormattedHexString(ntReceive_Table[nReceive_Index - 1], 2, sCRC1HEX);
NumberToFormattedHexString(ntReceive_Table[nReceive_Index - 2], 2, sCRC2HEX);
sCRC_R_Check = sCRC1HEX;
sCRC_R_Check += sCRC2HEX;

if ( not sCRCHEX == sCRC_R_Check) then
sReturn_Status ="CRC Mismatch";
endif

Obviously ‘sCRCHEX’ will only equate to ‘sCRC_R_Check’ if and only if ‘sCRCHEX’ equals zero, highly unlikely.

The proper coding for the conditional test should be:

if ( not (sCRCHEX == sCRC_R_Check)) then
sReturn_Status ="CRC Mismatch";
endif

There are four instances of this same error in the chart at lines 49, 58, 88, and 150, which will cause problems with the slave addresses, CRC and LRC tests.
No other charts in the ‘Slave’ portion of the integration kit contain this conditional test error, I didn’t check the ‘Master’ charts.

I sure hope that the finding of an error will not cause Opto22 to stop providing free application code to us end users. All free items come with inherent caveats in my humble opinion. Re-inventing the wheel is wasteful.
With the whole Opto22 user community involved, bugs such as this will more likely be found and eliminated, whereas individually written application code wouldn’t undergo as much scrutiny.
Therefore, the bottom line is that the free code can actually make the world a safer place, so keep it coming.

Sincerely,

Vincent Sumoski
PPL Interstate Energy Company

   Report 
OptoForums » Product Forum » Protocols and D... » Bug in the Modbus/Serial Integration Kit for ioControl?

Powered by Community Server, by Telligent Systems