Returning an array from generic_message
Hi, I am using this Library in order to read an write data to a ConveyLinx device, I can successfully read and write data while using the class b'\x64' (program_name) using the "physical" parameters from the device, however, i would like to access the "virtual" parameters from it by using assemblies. However, due to my inexperience with the protocol, I am struggling to do it.
Following the device documentation (https://www.manula.com/manuals/pulseroller/conveylinx-ersc/2/en/topic/reading-ersc-input-assembly-with-msg-instruction), i changed the class to b'\x64' (assembly), and used the instance 105 (Assem105 in the EDS file) and used the attributes 3 and 4 (according to documentation), though i didn't figure why these attributes are the only ones supported. The device documentation shows the Assem105 being stored in an array, however, i am not sure how can i get this array here. Am i doing something wrong? Did i misunderstood something?
Assembly example from EDS file:
[Assembly]
Object_Name = "Assembly Object";
Object_Class_Code = 0x04;
Assem105 =
"ZPA to PLC",
"20 04 24 69 30 03",
,
0x0000,
,,
16,Param116,
16,Param196,
16,Param106,
16,Param107,
16,Param186,
16,Param187,
32,Param88,
32,Param119,
32,Param199,
16,Param105,
16,Param185,
32,Param201,
32,Param121,
16,Param35,
16,Param514,
16,Param19;
How i called my read_parameter function:
def read_parameter(device_ip, service, class_code, instance, attribute):
with CIPDriver(device_ip) as drive:
param = drive.generic_message(
service=service,
class_code=class_code,
instance=instance,
attribute=attribute,
data_type=INT,
connected=True,
name='read_param'
)
print(param)
return param.value
read_parameter("192.168.202.39", b'\x0e', b'\x04', 105, 3)
Output from the print function inside read_parameter:
read_param, 0, INT, None
Thanks in advance
I believe your data type needs to be set to an array. See below:
param = drive.generic_message(
service=service,
class_code=class_code,
instance=instance,
attribute=attribute,
data_type=INT[10], #change 10 to the size of the array you're reading
connected=True,
name='read_param'```