Skip to content
Discussion options

You must be logged in to vote

I've tested your code on my PLC, and it works. You can see it on the screenshot:

Here's the code that I've run:


def find_datatype(memory_address):
    if memory_address.split(',')[1][0] == 'X':
        return S7WLBit
    elif memory_address.split(',')[1][0] == 'D':
        return S7WLWord

if __name__ == '__main__':

    client = snap7.client.Client()
    client.connect('10.10.10.100', 0, 1)

    if client.get_connected():

        tag_addresses = ["DB1,X6.0", "DB1,D2"]

        data_items = (S7DataItem * len(tag_addresses))()

        for i in range(len(data_items)):
            data_items[i].Area = ctypes.c_int32(S7AreaDB)
            data_items[i].WordLen = ctypes.c_int32(find_dataty…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Rahul14189
Comment options

Comment options

You must be logged in to vote
1 reply
@Rahul14189
Comment options

Answer selected by Rahul14189
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants