pyLSV2
pyLSV2 copied to clipboard
pyLSV2.err.LSV2InputException: highest address is 15000 but address of last requested element is 26733
Hi,
Library: pyLSV2 1.3.3
Controller: TNC-Type: TNC640 NC-Version: 340590 08 SP7 PLC-Version: 17-M008-V01SP11
I am trying to read DWord 26732, which for my TNC 640 holds the actual tool number, and i get this error
>>> print(con.read_plc_memory(26732, lsv.const.MemoryType.DWORD, 1)) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\bernardi\virtual-env\heidenhain\lib\site-packages\pyLSV2\client.py", line 1286, in read_plc_memory raise LSV2InputException( pyLSV2.err.LSV2InputException: highest address is 15000 but address of last requested element is 26733
I checked the source code "const.py", and I am not sure why for DWORD the max elements is
max_elements = self._sys_par.number_of_words / 4
instead of
max_elements = self._sys_par.number_of_words / 2
Is this correct? As far as i know 1 DWORD = 2 WORD = 4 BYTE --> if I get a total of 100 words in my controller, I should be able to see them also as 200 bytes or 50 dwords.
This is from the actual SYS_\runtime\PlcDataMarker.txt file in the service data generated by the controller, just to show where I found the memory address:
<Global>\NN_DG_TOOL_NUMBER D26732 D=0
Thanks