Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing REAL value in generic_message #316

Open
yu5800 opened this issue Apr 11, 2024 · 1 comment
Open

Writing REAL value in generic_message #316

yu5800 opened this issue Apr 11, 2024 · 1 comment
Labels
question Further information is requested

Comments

@yu5800
Copy link

yu5800 commented Apr 11, 2024

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

@yu5800 yu5800 added the question Further information is requested label Apr 11, 2024
@Colt-H
Copy link
Contributor

Colt-H commented May 1, 2024

See #279, there has been some luck setting route_path to false and/or none.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants