first commit
This commit is contained in:
8
app/services/modbus/commands/bit_coil.rb
Normal file
8
app/services/modbus/commands/bit_coil.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# Modbus::Service.new(plc_id: 1, type: "bit_coil", start_address: 0, end_address: 15).execute
|
||||
module Modbus
|
||||
module Commands
|
||||
def bit_coil(slave)
|
||||
read_bit(slave, :read_coils)
|
||||
end
|
||||
end
|
||||
end
|
||||
8
app/services/modbus/commands/bit_input.rb
Normal file
8
app/services/modbus/commands/bit_input.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# Modbus::Service.new(plc_id: 1, type: "bit_input", start_address: 0, end_address: 15).execute
|
||||
module Modbus
|
||||
module Commands
|
||||
def bit_input(slave)
|
||||
read_bit(slave, :discrete_inputs)
|
||||
end
|
||||
end
|
||||
end
|
||||
8
app/services/modbus/commands/word_holding_float32.rb
Normal file
8
app/services/modbus/commands/word_holding_float32.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# Modbus::Service.new(plc_id: 1, type: "word_holding_float32", start_address: 0, end_address: 15).execute
|
||||
module Modbus
|
||||
module Commands
|
||||
def word_holding_float32(slave)
|
||||
read_float(slave, :holding_registers)
|
||||
end
|
||||
end
|
||||
end
|
||||
8
app/services/modbus/commands/word_holding_int16.rb
Normal file
8
app/services/modbus/commands/word_holding_int16.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# Modbus::Service.new(plc_id: 1, type: "word_holding_int16", start_address: 16, end_address: 31).execute
|
||||
module Modbus
|
||||
module Commands
|
||||
def word_holding_int16(slave)
|
||||
read_int(slave, 16, :holding_registers)
|
||||
end
|
||||
end
|
||||
end
|
||||
8
app/services/modbus/commands/word_input_float32.rb
Normal file
8
app/services/modbus/commands/word_input_float32.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# Modbus::Service.new(plc_id: 1, type: "word_input_float32", start_address: 0, end_address: 15).execute
|
||||
module Modbus
|
||||
module Commands
|
||||
def word_input_float32(slave)
|
||||
read_float(slave, :input_registers)
|
||||
end
|
||||
end
|
||||
end
|
||||
8
app/services/modbus/commands/word_input_int16.rb
Normal file
8
app/services/modbus/commands/word_input_int16.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# Modbus::Service.new(plc_id: 1, type: "word_input_int16", start_address: 0, end_address: 15).execute
|
||||
module Modbus
|
||||
module Commands
|
||||
def word_input_int16(slave)
|
||||
read_int(slave, 16, :input_registers)
|
||||
end
|
||||
end
|
||||
end
|
||||
8
app/services/modbus/commands/write_bit.rb
Normal file
8
app/services/modbus/commands/write_bit.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# Modbus::Service.new(plc_id: 1, type: "write_bit", start_address: 0, value: 1).execute
|
||||
module Modbus
|
||||
module Commands
|
||||
def write_bit(slave)
|
||||
write_coil(slave)
|
||||
end
|
||||
end
|
||||
end
|
||||
8
app/services/modbus/commands/write_bit_toggle.rb
Normal file
8
app/services/modbus/commands/write_bit_toggle.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# Modbus::Service.new(plc_id: 1, type: "write_bit_toggle", start_address: 0).execute
|
||||
module Modbus
|
||||
module Commands
|
||||
def write_bit_toggle(slave)
|
||||
write_toggle_coil(slave)
|
||||
end
|
||||
end
|
||||
end
|
||||
8
app/services/modbus/commands/write_float32.rb
Normal file
8
app/services/modbus/commands/write_float32.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# Modbus::Service.new(plc_id: 1, type: "float32", start_address: 0, value: 123.45).execute
|
||||
module Modbus
|
||||
module Commands
|
||||
def write_float32(slave)
|
||||
write_float(slave)
|
||||
end
|
||||
end
|
||||
end
|
||||
8
app/services/modbus/commands/write_int16.rb
Normal file
8
app/services/modbus/commands/write_int16.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# Modbus::Service.new(plc_id: 1, type: "int16", start_address: 0, value: 123).execute
|
||||
module Modbus
|
||||
module Commands
|
||||
def write_int16(slave)
|
||||
write_int(slave, 16)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user