This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Writing problem in MODBUS with profile
#1
I have a problem with modbus function 16, reading works perfectly through the profile, but I can only write through the lua script. With this script I can write: 
Code:
require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485-1', 9600, 'N', 8, 1, 'H')
mb:connect()
mb:setslave(20)
mb:writemultipleregisters(20, 1)
mb:close()

and this is the profile I use: 
Code:
{
  "product_code": "eHome",
  "mapping": [
{"address":10,"datatype":"int16","read_swap":"n","bus_datatype":"float16","value_custom":{ },"type":"inputregister","units":"A","value_multiplier":1,"write_multiple":false,"writable":false,"bus_address":"34/0/100","name":"Cargador_1 Intensidad del vehículo por cable -R-"},
{"address":11,"datatype":"int16","read_swap":"n","bus_datatype":"int16","value_custom":{ "1":"A","2":"B","3":"C","4":"D"},"type":"inputregister","units":" ","value_multiplier":1,"write_multiple":false,"writable":false,"bus_address":"34/0/101","name":"Cargador_1 Estado de carga E.V. -R-"},
{"address":12,"datatype":"int16","read_swap":"n","bus_datatype":"int16","value_custom":{ },"type":"inputregister","units":"er","value_multiplier":1,"write_multiple":false,"writable":false,"bus_address":"34/0/102","name":"Cargador_1 Código de error 1 -R-"},
{"address":13,"datatype":"int16","read_swap":"n","bus_datatype":"int16","value_custom":{ },"type":"inputregister","units":"er","value_multiplier":1,"write_multiple":false,"writable":false,"bus_address":"34/0/103","name":"Cargador_1 Código de error 2 -R-"},
{"address":14,"datatype":"int16","read_swap":"n","bus_datatype":"int16","value_custom":{ },"type":"inputregister","units":"er","value_multiplier":1,"write_multiple":false,"writable":false,"bus_address":"34/0/104","name":"Cargador_1 Código de error 3 -R-"},
{"address":15,"datatype":"int16","read_swap":"n","bus_datatype":"int16","value_custom":{ },"type":"inputregister","units":"A","value_multiplier":1,"write_multiple":false,"writable":false,"bus_address":"34/0/105","name":"Cargador_1 Máxima Potencia de alimentación -R-"},
{"address":16,"datatype":"int16","read_swap":"n","bus_datatype":"int16","value_custom":{ },"type":"inputregister","units":"A","value_multiplier":1,"write_multiple":true,"writable":true,"bus_address":"34/0/106","name":"Cargador_1 Establecer máxima potencia de alimentacion -R/W-"},
{"address":17,"datatype":"int16","read_swap":"n","bus_datatype":"int16","value_custom":{ },"type":"inputregister","units":"%","value_multiplier":1,"write_multiple":true,"writable":true,"bus_address":"34/0/107","name":"Cargador_1 Establecer el porcentaje de intensidad de carga -R/W-"},
{"address":18,"datatype":"int16","read_swap":"n","bus_datatype":"int16","value_custom":{ },"type":"inputregister","units":"min","value_multiplier":1,"write_multiple":false,"writable":false,"bus_address":"34/0/108","name":"Cargador_1 Contador de minutos de última carga. -R-"},
{"address":19,"datatype":"int16","read_swap":"n","bus_datatype":"int16","value_custom":{ },"type":"inputregister","units":"min","value_multiplier":1,"write_multiple":false,"writable":false,"bus_address":"34/0/109","name":"Cargador_1 Contador de minutos de carga actual -R-"},
{"address":20,"datatype":"int16","read_swap":"n","bus_datatype":"bool","value_custom":{ },"type":"inputregister","units":" ","value_multiplier":1,"write_multiple":true,"writable":true,"bus_address":"34/0/110","name":"Cargador_1 Inicio de carga del V.E. -R/W-"},
{"address":21,"datatype":"int16","read_swap":"n","bus_datatype":"bool","value_custom":{ },"type":"inputregister","units":" ","value_multiplier":1,"write_multiple":true,"writable":true,"bus_address":"34/0/111","name":"Cargador_1 Parada de carga el V.E.  -R/W-"},
{"address":22,"datatype":"int16","read_swap":"n","bus_datatype":"bool","value_custom":{ },"type":"inputregister","units":" ","value_multiplier":1,"write_multiple":true,"writable":true,"bus_address":"34/0/112","name":"Cargador_1 Parada temporal de la carga. -R/W-"},
{"address":23,"datatype":"int16","read_swap":"n","bus_datatype":"bool","value_custom":{ },"type":"inputregister","units":" ","value_multiplier":1,"write_multiple":true,"writable":true,"bus_address":"34/0/113","name":"Cargador_1 Puerto de carga deshabilitado -R/W-"},
{"address":24,"datatype":"int16","read_swap":"n","bus_datatype":"bool","value_custom":{ },"type":"inputregister","units":" ","value_multiplier":1,"write_multiple":true,"writable":true,"bus_address":"34/0/114","name":"Cargador_1 Control remoto por controlador DLM -R/W-"},
{"address":60,"datatype":"int16","read_swap":"n","bus_datatype":"float16","value_custom":{ },"type":"inputregister","units":"C","value_multiplier":1,"write_multiple":false,"writable":false,"bus_address":"34/0/115","name":"Cargador_1 Valor interno de la temperatura -R-"},
{"address":61,"datatype":"int16","read_swap":"n","bus_datatype":"float16","value_custom":{ },"type":"inputregister","units":"C","value_multiplier":1,"write_multiple":true,"writable":true,"bus_address":"34/0/116","name":"Cargador_1 Calibración de temperatura -R/W-"},
{"address":62,"datatype":"int16","read_swap":"n","bus_datatype":"bool","value_custom":{ },"type":"inputregister","units":" ","value_multiplier":1,"write_multiple":true,"writable":true,"bus_address":"34/0/117","name":"Cargador_1 Activar reducción de corriente por temperatura -R/W-"},
{"address":63,"datatype":"int16","read_swap":"n","bus_datatype":"bool","value_custom":{ },"type":"inputregister","units":" ","value_multiplier":1,"write_multiple":false,"writable":false,"bus_address":"34/0/118","name":"Cargador_1 Activar reducción de corriente -R-"},
{"address":0,"datatype":"int16","read_swap":"n","bus_datatype":"int16","value_custom":{ },"type":"inputregister","units":" ","value_multiplier":1,"write_multiple":true,"writable":true,"bus_address":"34/0/120","name":"Cargador_1 Dirección Periférica -R/W-"}

  ],
  "manufacturer": "CIRCUTOR",
  "name": "eHome",
  "product_range": "Cargador monofasico 7Kw",
  "description": "Cargador monofasico de 7Kw para coche electrico"
}


Please can you tell me where the error is?
Reply
#2
"inputregister" is read-only. Change type to "register" in mapping entries that should be writable.
Reply
#3
ok, thank you very much, it works now!!!
Reply


Forum Jump: