Skip to content

Writing REAL value in generic_message #316

@yu5800

Description

@yu5800

Hello,
I'm having trouble communicating with a mass flow controller via Ethernet/IP. In my application, I want to read and write data. I was able to successfully read data using generic_message. However, I haven't been able to write data (for example, setting the setpoint). Only INT values can be sent, not REAL values as described in the device documentation. So the setpoint is not set correctly. I'm not sure if I need to input something else or if it's the device itself.
Here's my code:

with CIPDriver(ip) as drive:
        read_setpoint = drive.generic_message(
            service=Services.get_attribute_single,
            class_code=b'\x65',
            instance=b'\x01', 
            attribute=b'\x03',
            data_type=REAL,
            connected=False,
            #unconnected_send=True, 
            route_path=True,
            name='Read Setpoint'
        )
with CIPDriver(ip) as drive:
        write_setpoint = drive.generic_message(
            service=Services.set_attribute_single,
            class_code=b'\x65',
            instance=b'\x01', 
            attribute=b'\x03',
            request_data=REAL.encode(10),
            data_type=REAL,
            connected=False,
            #unconnected_send=True, 
            route_path=True,
            name='Write Setpoint'
        )

With print(read_setpoint) I get the output Read Setpoint, 0.0, REAL, None
With print(write_setpoint) I get the output Write Setpoint, None, REAL, Too much data

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions