Name | TCPIPLS JSON |
Version |
2.1
JSON |
| download |
home_page | |
Summary | Python connect to PLC LS |
upload_time | 2023-11-03 05:47:03 |
maintainer | |
docs_url | None |
author | Quangcha |
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/IP
LS protocol(LS electric Communication Protocol) implementation by Python. LS protocol enables you to operate PLC from computer.
# import library
from TCPIP.LS import conn_plpc
# setting PLC IP and Port
PLC_INFORM = {"host":"192.168.1.10", "port":2004} # Port :2004 XGT server TCP/IP
# connect to PLC
conn = conn_plpc(\*\*PLC_INFORM)
# write device
val = conn.plc_comm("XGB", "write", "bit", "M70","1")# Write ON to Bit M70
val = conn.plc_comm("XGB", "write", "bit", "M70") or conn.plc_comm("XGB", "write", "bit", "M70","0") # Write OFF to Bit M70
val = conn.plc_comm("XGB", "write", "byte", "D100","20") # Write 20 to 100th Byte(int8) D50( beacause 1 D= int16)
val = conn.plc_comm("XGB", "write", "word", "D100","1") # write 1 to Word(int16) D100
val = conn.plc_comm("XGB", "write", "dword", "D50","1") # Write 1 to 50th doubleWord(int32)( D100-D101)
val = conn.plc_comm("XGB", "write", "lword", "D25","1") # Write 1 to 25th long(int64) ( D100-D101-d102-d103)
# read device
val = conn.plc_comm("XGB", "read", "bit", "M70") # read Bit M70 return [1] or [0]
val = conn.plc_comm("XGB", "read", "byte", "D100") # read 100th Byte(int8) D50( beacause 1 D= int16)
val = conn.plc_comm("XGB", "read", "word", "D100) # read Word(int16) D100
val = conn.plc_comm("XGB", "read", "dword", "D50) # read 50th doubleWord(int32)( D100-D101)
val = conn.plc_comm("XGB", "read", "lword", "D25) # read 25th long(int64) ( D100-D101-d102-d103)
# write multi device
val = conn.plc_comm("XGB", "write", "bit", "M70,M71,M72","1,0,1")# Write ON to Bit M70, OFF M71 and ON M72
val = conn.plc_comm("XGB", "write", "bit", "M70,M71,M72") # write off all 3 bits M70,M71,M72
.......................
# read multi device
val = conn.plc_comm("XGB", "read", "bit", "M70,M71,M72") # read 3 Bits M70,M71,M72 return [1,0,1]
.............................................
Raw data
{
"_id": null,
"home_page": "",
"name": "TCPIPLS",
"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/3a/de/72a50e108fcdde79455638491390d9fd366ad135e259a3309d4db2b7bf89/TCPIPLS-2.1.tar.gz",
"platform": null,
"description": "# Python connect to PLC LS by TCP/IP\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 TCPIP.LS import conn_plpc\r\n\r\n# setting PLC IP and Port\r\n\r\nPLC_INFORM = {\"host\":\"192.168.1.10\", \"port\":2004} # Port :2004 XGT server TCP/IP\r\n\r\n# connect to PLC\r\n\r\nconn = conn_plpc(\\*\\*PLC_INFORM)\r\n\r\n# write device\r\n\r\nval = conn.plc_comm(\"XGB\", \"write\", \"bit\", \"M70\",\"1\")# Write ON to Bit M70\r\n\r\nval = conn.plc_comm(\"XGB\", \"write\", \"bit\", \"M70\") or conn.plc_comm(\"XGB\", \"write\", \"bit\", \"M70\",\"0\") # Write OFF to Bit M70\r\n\r\nval = conn.plc_comm(\"XGB\", \"write\", \"byte\", \"D100\",\"20\") # Write 20 to 100th Byte(int8) D50( beacause 1 D= int16)\r\n\r\nval = conn.plc_comm(\"XGB\", \"write\", \"word\", \"D100\",\"1\") # write 1 to Word(int16) D100\r\n\r\nval = conn.plc_comm(\"XGB\", \"write\", \"dword\", \"D50\",\"1\") # Write 1 to 50th doubleWord(int32)( D100-D101)\r\n\r\nval = conn.plc_comm(\"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.plc_comm(\"XGB\", \"read\", \"bit\", \"M70\") # read Bit M70 return [1] or [0]\r\n\r\nval = conn.plc_comm(\"XGB\", \"read\", \"byte\", \"D100\") # read 100th Byte(int8) D50( beacause 1 D= int16)\r\n\r\nval = conn.plc_comm(\"XGB\", \"read\", \"word\", \"D100) # read Word(int16) D100\r\n\r\nval = conn.plc_comm(\"XGB\", \"read\", \"dword\", \"D50) # read 50th doubleWord(int32)( D100-D101)\r\n\r\nval = conn.plc_comm(\"XGB\", \"read\", \"lword\", \"D25) # read 25th long(int64) ( D100-D101-d102-d103)\r\n\r\n# write multi device\r\n\r\nval = conn.plc_comm(\"XGB\", \"write\", \"bit\", \"M70,M71,M72\",\"1,0,1\")# Write ON to Bit M70, OFF M71 and ON M72\r\n\r\nval = conn.plc_comm(\"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.plc_comm(\"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": "2.1",
"project_urls": null,
"split_keywords": [
"plc",
"protocol",
"ls electric"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9c8769439a5b3bfb5939ed1ec20e95e36482a2a55a316bc1cab08af0f7c04665",
"md5": "5a87c790bbee8994b0f9f24c691dfdd6",
"sha256": "a65e2ead6a58ab5a4cc44fdb5afefbf064572e73c543daeb8ed7f2432c94a789"
},
"downloads": -1,
"filename": "TCPIPLS-2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5a87c790bbee8994b0f9f24c691dfdd6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3446,
"upload_time": "2023-11-03T05:47:01",
"upload_time_iso_8601": "2023-11-03T05:47:01.586909Z",
"url": "https://files.pythonhosted.org/packages/9c/87/69439a5b3bfb5939ed1ec20e95e36482a2a55a316bc1cab08af0f7c04665/TCPIPLS-2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3ade72a50e108fcdde79455638491390d9fd366ad135e259a3309d4db2b7bf89",
"md5": "c25f45a01382b0ab5dae07f309e6ad7b",
"sha256": "fa21a18d26c47924e2c257b8bd4255d5458749042c4a98a14d48f35ab2c4678e"
},
"downloads": -1,
"filename": "TCPIPLS-2.1.tar.gz",
"has_sig": false,
"md5_digest": "c25f45a01382b0ab5dae07f309e6ad7b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3249,
"upload_time": "2023-11-03T05:47:03",
"upload_time_iso_8601": "2023-11-03T05:47:03.660709Z",
"url": "https://files.pythonhosted.org/packages/3a/de/72a50e108fcdde79455638491390d9fd366ad135e259a3309d4db2b7bf89/TCPIPLS-2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-03 05:47:03",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "tcpipls"
}