PyXGT


NamePyXGT JSON
Version 1.1 PyPI version JSON
download
home_page
SummaryPython connect to PLC LS
upload_time2023-11-04 01:28:40
maintainer
docs_urlNone
authorQuangcha
requires_python
license
keywords plc protocol ls electric
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python connect to PLC LS by TCP XGT Server

LS protocol(LS electric Communication Protocol) implementation by Python. LS protocol enables you to operate PLC from computer.

# import library

from PyXGT.LS import plc_ls

# connect to PLC

conn = plc_ls("192.168.1.10",2004) #PLC LS IP and port: 2004 (TCP XGT server)

# write device

val = conn.command("XGB", "write", "bit", "M70","1")# Write ON to Bit M70

val = conn.command("XGB", "write", "bit", "M70") or conn.command("XGB", "write", "bit", "M70","0") # Write OFF to Bit M70

val = conn.command("XGB", "write", "byte", "D100","20") # Write 20 to 100th Byte(int8) D50( beacause 1 D= int16)

val = conn.command("XGB", "write", "word", "D100","1") # write 1 to Word(int16) D100

val = conn.command("XGB", "write", "dword", "D50","1") # Write 1 to 50th doubleWord(int32)( D100-D101)

val = conn.command("XGB", "write", "lword", "D25","1") # Write 1 to 25th long(int64) ( D100-D101-d102-d103)

# read device

val = conn.command("XGB", "read", "bit", "M70") # read Bit M70 return [1] or [0]

val = conn.command("XGB", "read", "byte", "D100") # read 100th Byte(int8) D50( beacause 1 D= int16)

val = conn.command("XGB", "read", "word", "D100) # read Word(int16) D100

val = conn.command("XGB", "read", "dword", "D50) # read 50th doubleWord(int32)( D100-D101)

val = conn.command("XGB", "read", "lword", "D25) # read 25th long(int64) ( D100-D101-d102-d103)

# write multi device

val = conn.command("XGB", "write", "bit", "M70,M71,M72","1,0,1")# Write ON to Bit M70, OFF M71 and ON M72

val = conn.command("XGB", "write", "bit", "M70,M71,M72") # write off all 3 bits M70,M71,M72

.......................

# read multi device

val = conn.command("XGB", "read", "bit", "M70,M71,M72") # read 3 Bits M70,M71,M72 return [1,0,1]

.............................................

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "PyXGT",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "PLC,protocol,LS electric",
    "author": "Quangcha",
    "author_email": "duyquangd4.bk@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/dc/53/a000257f44c9f7becceefe5e36acfe32b5b77e9da52e89c4fe332b6bd08b/PyXGT-1.1.tar.gz",
    "platform": null,
    "description": "# Python connect to PLC LS by TCP XGT Server\r\n\r\nLS protocol(LS electric Communication Protocol) implementation by Python. LS protocol enables you to operate PLC from computer.\r\n\r\n# import library\r\n\r\nfrom PyXGT.LS import plc_ls\r\n\r\n# connect to PLC\r\n\r\nconn = plc_ls(\"192.168.1.10\",2004) #PLC LS IP and port: 2004 (TCP XGT server)\r\n\r\n# write device\r\n\r\nval = conn.command(\"XGB\", \"write\", \"bit\", \"M70\",\"1\")# Write ON to Bit M70\r\n\r\nval = conn.command(\"XGB\", \"write\", \"bit\", \"M70\") or conn.command(\"XGB\", \"write\", \"bit\", \"M70\",\"0\") # Write OFF to Bit M70\r\n\r\nval = conn.command(\"XGB\", \"write\", \"byte\", \"D100\",\"20\") # Write 20 to 100th Byte(int8) D50( beacause 1 D= int16)\r\n\r\nval = conn.command(\"XGB\", \"write\", \"word\", \"D100\",\"1\") # write 1 to Word(int16) D100\r\n\r\nval = conn.command(\"XGB\", \"write\", \"dword\", \"D50\",\"1\") # Write 1 to 50th doubleWord(int32)( D100-D101)\r\n\r\nval = conn.command(\"XGB\", \"write\", \"lword\", \"D25\",\"1\") # Write 1 to 25th long(int64) ( D100-D101-d102-d103)\r\n\r\n# read device\r\n\r\nval = conn.command(\"XGB\", \"read\", \"bit\", \"M70\") # read Bit M70 return [1] or [0]\r\n\r\nval = conn.command(\"XGB\", \"read\", \"byte\", \"D100\") # read 100th Byte(int8) D50( beacause 1 D= int16)\r\n\r\nval = conn.command(\"XGB\", \"read\", \"word\", \"D100) # read Word(int16) D100\r\n\r\nval = conn.command(\"XGB\", \"read\", \"dword\", \"D50) # read 50th doubleWord(int32)( D100-D101)\r\n\r\nval = conn.command(\"XGB\", \"read\", \"lword\", \"D25) # read 25th long(int64) ( D100-D101-d102-d103)\r\n\r\n# write multi device\r\n\r\nval = conn.command(\"XGB\", \"write\", \"bit\", \"M70,M71,M72\",\"1,0,1\")# Write ON to Bit M70, OFF M71 and ON M72\r\n\r\nval = conn.command(\"XGB\", \"write\", \"bit\", \"M70,M71,M72\") # write off all 3 bits M70,M71,M72\r\n\r\n.......................\r\n\r\n# read multi device\r\n\r\nval = conn.command(\"XGB\", \"read\", \"bit\", \"M70,M71,M72\") # read 3 Bits M70,M71,M72 return [1,0,1]\r\n\r\n.............................................\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python connect to PLC LS",
    "version": "1.1",
    "project_urls": null,
    "split_keywords": [
        "plc",
        "protocol",
        "ls electric"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "39d02f69e3ab69caac13bb5f4d8ed234ccbf9e513c47b720d134bc5fd6fc933b",
                "md5": "4cb937b6b38f9943c3a31ea0bed254f8",
                "sha256": "eca215f9285703989318578ec31219cca7d9241d6ec866ed42c8ae782be95583"
            },
            "downloads": -1,
            "filename": "PyXGT-1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4cb937b6b38f9943c3a31ea0bed254f8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 3115,
            "upload_time": "2023-11-04T01:28:38",
            "upload_time_iso_8601": "2023-11-04T01:28:38.267911Z",
            "url": "https://files.pythonhosted.org/packages/39/d0/2f69e3ab69caac13bb5f4d8ed234ccbf9e513c47b720d134bc5fd6fc933b/PyXGT-1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dc53a000257f44c9f7becceefe5e36acfe32b5b77e9da52e89c4fe332b6bd08b",
                "md5": "8858523758703fc06d0a160f8e4d68ea",
                "sha256": "d606a00dd52c2e27252d7975f9f94497f7ca3497784ff05dae9ea79f77cc5940"
            },
            "downloads": -1,
            "filename": "PyXGT-1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8858523758703fc06d0a160f8e4d68ea",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2918,
            "upload_time": "2023-11-04T01:28:40",
            "upload_time_iso_8601": "2023-11-04T01:28:40.029121Z",
            "url": "https://files.pythonhosted.org/packages/dc/53/a000257f44c9f7becceefe5e36acfe32b5b77e9da52e89c4fe332b6bd08b/PyXGT-1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-04 01:28:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pyxgt"
}
        
Elapsed time: 1.81941s