Browse files

Added write_diagnostic

  • Loading branch information...
1 parent addb5e3 commit 7588e433d884e2138144f691d543abf5b883179d @jhickner committed Sep 27, 2011
Showing with 10 additions and 0 deletions.
  1. +10 −0 lib/rmodbus/slave.rb
View
10 lib/rmodbus/slave.rb
@@ -194,6 +194,16 @@ def write_single_register(addr, val)
end
alias_method :write_holding_register, :write_single_register
+ # Write a single diagnostic register
+ #
+ # @example
+ # write_diagnostic(1, "\xff\x00") => [255, 0]
+ # @param [Integer] subfunc diagnostic subfunction
+ # @param [Integer] data subfunction data
+ # @return [Array] echoes back the passed in data
+ def write_diagnostic(subfunc, data)
+ query("\x8" + subfunc.to_word + data)
+ end
# Write multiple holding registers
#

0 comments on commit 7588e43

Please sign in to comment.