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

Reading Local Variable from Micro820 #48

Closed
mglowinski93 opened this issue Apr 21, 2019 · 11 comments
Closed

Reading Local Variable from Micro820 #48

mglowinski93 opened this issue Apr 21, 2019 · 11 comments

Comments

@mglowinski93
Copy link

mglowinski93 commented Apr 21, 2019

Hi,
i'm trying to read local variable from Micro 820, but i'm getting error:

Analog value: 0
Digital value: False
Traceback (most recent call last):
  File "C:/Users/mglow/Documents/Projects/RaspberryPi And Rockwell Communication/Python/main.py", line 11, in <module>
    own_value = comm.Read('Program:MAIN.MyOutput')
  File "C:\Users\mglow\Documents\Projects\RaspberryPi And Rockwell Communication\Python\venv\lib\site-packages\pylogix\eip.py", line 90, in Read
    return _readTag(self, tag, count, datatype)
  File "C:\Users\mglow\Documents\Projects\RaspberryPi And Rockwell Communication\Python\venv\lib\site-packages\pylogix\eip.py", line 203, in _readTag
    InitialRead(self, t, b, dt)
  File "C:\Users\mglow\Documents\Projects\RaspberryPi And Rockwell Communication\Python\venv\lib\site-packages\pylogix\eip.py", line 1506, in InitialRead
    raise ValueError('Failed to read tag: {}'.format(err))
ValueError: Failed to read tag: Path destination unknown

Process finished with exit code 1

Python code:

from pylogix import PLC
from socket import timeout # This is raised when no connection with PLC

with PLC() as comm:
    comm.Micro800 = True
    comm.IPAddress = "192.168.178.58"
    analog_value = comm.Read('_IO_EM_AI_00')
    print(f'Analog value: {analog_value}')
    digital_value = comm.Read('_IO_EM_DI_00')
    print(f'Digital value: {digital_value}')
    own_value = comm.Read('Program:MAIN.MyOutput')
    print(f"My own value from SUBPROGRAM: {own_value}")

On Micro 820 i've created a Program MAIN and inside local variables "MyOutput".

I will be grateful for all tips related to this problem:)
btw. i've seen #8, but there is no clear answer

@dmroeder
Copy link
Owner

Unfortunately, there is no way to read local variables, Rockwell doesn't provide a way. You can only read global variables.

@mglowinski93
Copy link
Author

At least it is clear now. Thanks for reply.

@evaldes2015
Copy link

Is this issue specific to the Micro820? Because I can read program locals on an CompactLogix.

@dmroeder
Copy link
Owner

This is specific to the Micro820 and 850.

@mglowinski93
Copy link
Author

I can ask Rockwell Directly (i'm cooperating with them very often), if you tell me what to ask about.

@bashiryousufy
Copy link

@mglowinski93 Did you find a way to read local variable?

@mglowinski93
Copy link
Author

@mglowinski93 Did you find a way to read local variable?

No, i didn't.

@bashiryousufy
Copy link

@mglowinski93 Did you find a way to read local variable?

No, i didn't.

Did you find any alternatives?

So basically I want to be able to read counter data and also be able to reset the counter using this package. Do you think its possible?

Note: Using Mirco820 PLC

@mglowinski93
Copy link
Author

@mglowinski93 Did you find a way to read local variable?

No, i didn't.

Did you find any alternatives?

So basically I want to be able to read counter data and also be able to reset the counter using this package. Do you think its possible?

Note: Using Mirco820 PLC

No, I did not.
I simply mapped local variables to global ones, it was enough in my case.

@bashiryousufy
Copy link

@mglowinski93 Did you find a way to read local variable?

No, i didn't.

Did you find any alternatives?
So basically I want to be able to read counter data and also be able to reset the counter using this package. Do you think its possible?
Note: Using Mirco820 PLC

No, I did not. I simply mapped local variables to global ones, it was enough in my case.

Any tips on how to achieve the mapping?

@mglowinski93
Copy link
Author

@mglowinski93 Did you find a way to read local variable?

No, i didn't.

Did you find any alternatives?
So basically I want to be able to read counter data and also be able to reset the counter using this package. Do you think its possible?
Note: Using Mirco820 PLC

No, I did not. I simply mapped local variables to global ones, it was enough in my case.

Any tips on how to achieve the mapping?

I simply used the COPY instruction.

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

No branches or pull requests

4 participants