In CODESYS 3.5 V15 I try to read data on Modbus from a Beckhoff Ethernet coupler ( BK9000+KL3314: input for thermocouple + KL3064 : Input 0-10V)
I have added an Ethernet Generic device and then add Modbus TCP Master and Slave (as I have seen in others threads).
I think I have put the proper parameters (IP adress: 192.168.1.48 = my BK9000 on the network, port = 502)
I have added input canal Chanel 1 with Read Holdings register (Offset = 1 (=0x0001) and data = 1) but I can't get any value when the program runs on the PLC (here a Raspberry with Jessie)
This is very surprising to me , because I can read both the value usine Python (with the pymodbus lib)
in python 3.7.4 on my windows computer
Code:
from pymodbus.client.sync import ModbusTcpClient
client = ModbusTcpClient('192.168.1.48', '502')
rr=client.read_holding_registers(1,1)
print('input: ', rr.getRegister(0))
It gives me the proper value of the Thermocouple
When I use KS2000 from Beckhoff, I can read also the value from Channel 1.
Do you know what i'm doing wrong in CODESYS ? It makes me made not to understand where the problem is.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Solution found.
Sometimes I feel that I'm not very clever. By the way, I just forgot to enabled an option about the updated of the variable.
indeed in the configuration of the PLC device (Here a Raspberry): Enable 1 ("Use bus cycle task if not used in any task") must be used in my project.
I can now get the thermocouple values through MODBUS.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In CODESYS 3.5 V15 I try to read data on Modbus from a Beckhoff Ethernet coupler ( BK9000+KL3314: input for thermocouple + KL3064 : Input 0-10V)
I have added an Ethernet Generic device and then add Modbus TCP Master and Slave (as I have seen in others threads).
I think I have put the proper parameters (IP adress: 192.168.1.48 = my BK9000 on the network, port = 502)
I have added input canal Chanel 1 with Read Holdings register (Offset = 1 (=0x0001) and data = 1) but I can't get any value when the program runs on the PLC (here a Raspberry with Jessie)
This is very surprising to me , because I can read both the value usine Python (with the pymodbus lib)
in python 3.7.4 on my windows computer
Code:
from pymodbus.client.sync import ModbusTcpClient
client = ModbusTcpClient('192.168.1.48', '502')
rr=client.read_holding_registers(1,1)
print('input: ', rr.getRegister(0))
It gives me the proper value of the Thermocouple
When I use KS2000 from Beckhoff, I can read also the value from Channel 1.
Do you know what i'm doing wrong in CODESYS ? It makes me made not to understand where the problem is.
Solution found.
Sometimes I feel that I'm not very clever. By the way, I just forgot to enabled an option about the updated of the variable.
indeed in the configuration of the PLC device (Here a Raspberry): Enable 1 ("Use bus cycle task if not used in any task") must be used in my project.
I can now get the thermocouple values through MODBUS.