Skip to content

Commit

Permalink
add test and demo for input/output word and dword
Browse files Browse the repository at this point in the history
  • Loading branch information
drunsinn committed Jun 20, 2024
1 parent 51ee6f5 commit dc57385
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pyLSV2/scripts/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ def comprehensive_demo():
print("## double word: {}".format(con.read_plc_memory(0, MemoryType.DWORD, 5)))
print("## string: {}".format(con.read_plc_memory(0, MemoryType.STRING, 5)))
print("## input: {}".format(con.read_plc_memory(0, MemoryType.INPUT, 5)))
print("## output: {}".format(con.read_plc_memory(0, MemoryType.OUTPUT_WORD, 5)))
print("## output: {}".format(con.read_plc_memory(0, MemoryType.OUTPUT, 5)))
print("## input word: {}".format(con.read_plc_memory(0, MemoryType.INPUT_WORD, 5)))
print("## output word: {}".format(con.read_plc_memory(0, MemoryType.OUTPUT_WORD, 5)))
print("## input dword: {}".format(con.read_plc_memory(0, MemoryType.INPUT_DWORD, 5)))
print("## output dword: {}".format(con.read_plc_memory(0, MemoryType.OUTPUT_DWORD, 5)))

print("# data values via data path, only available on some iTNC530")
if con.versions.is_itnc():
Expand Down
5 changes: 4 additions & 1 deletion tests/test_plc_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ def test_plc_read(address: str, timeout: float):
assert lsv2.read_plc_memory(0, pyLSV2.MemoryType.WORD, 1) is not False
assert lsv2.read_plc_memory(0, pyLSV2.MemoryType.DWORD, 1) is not False
assert lsv2.read_plc_memory(0, pyLSV2.MemoryType.STRING, 1) is not False
assert lsv2.read_plc_memory(0, pyLSV2.MemoryType.INPUT, 1) is not False
assert lsv2.read_plc_memory(0, pyLSV2.MemoryType.OUTPUT_WORD, 1) is not False
assert lsv2.read_plc_memory(0, pyLSV2.MemoryType.OUTPUT_DWORD, 1) is not False
assert lsv2.read_plc_memory(0, pyLSV2.MemoryType.INPUT, 1) is not False
assert lsv2.read_plc_memory(0, pyLSV2.MemoryType.INPUT_WORD, 1) is not False
assert lsv2.read_plc_memory(0, pyLSV2.MemoryType.INPUT_DWORD, 1) is not False

lsv2.logout(pyLSV2.Login.PLCDEBUG)

Expand Down

0 comments on commit dc57385

Please sign in to comment.