Coder Social home page Coder Social logo

pylsv2's People

Contributors

drunsinn avatar kekec14 avatar md-aliy7 avatar pandaroux8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pylsv2's Issues

signals at long & short intervals together

Hi,

I noticed that TNCscope can read signals of long intervals (e.g., position and velocity: 3 ms) & signals of short intervals (e.g., current: 0.6 ms) together with considering the frequency of each one (like position is updated only one time when the current can be updated 5 times at interval = 600 us chosen for both of them. As shown in the attached picture (current & velocity at x-axis):
image

I could change the code to behave like as following:

1- Cancelling these two lines:
image

2- Cancelling these lines:
image

3- Adding this if condition (special for interval = 600 us):
image

while this (count_high_freq) increases by one at the end of each for-inner loop.
It gives the same exact behavior, but this is very specific for interval = 600 us (as mentioned above) because of the very soft code while TNCscope has fewer choices with more codes of conditions.
I wonder if you have a better solution for it.

Reading PLC memory via memory address returns different values than reading via data path

Reading PLC memory via memory address like

con.read_plc_memory(356, pyLSV2.MemoryType.DWORD, 1)

returns the following:

  • Address 356: [4210752250]
  • Address 364: [4210752250]
  • Address 368: [4210752250]
  • Address 360: [4210752250]
  • Address 388: [44]

when accessing the same addresses via data path at the same time it returns the following:

con.read_data_path("/PLC/memory/D/356")

  • Address 356: 7000000
  • Address 364: 0
  • Address 368: 0
  • Address 360: 0
  • Address 388: 0

I'm not sure if I've missed anything, but up to pyLSV2 version 0.7.7 the values were the same.

I've discovered this on an iTNC530 / 606420 04 SP20. Help would be much appreciated.

memory loss and feedback

Hello everyone,

It's been a while since I've coded on this library, and I can no longer remember what the passwords are to connect, to access any information.
I would particularly like to connect with the "DNC" login to have the "execution_state" function

respectfully Baptou

Integrated Oscilloscope in TNC640

Hi,

Commenting on that quoted part in one of your replies:

first, regarding your comment with connection to the TNC640: I was referring to the TNCopt software. I used it to connect to a programming station while capturing the TCP packages. Up to a certain point I could follow the data but then some encrypted password was used. This is similar/the same as when recoding the connection between TNCscope and a TNC640. Until we manage to reverse the encryption I don't see any way to make it work.

Did you find any way to decrypt the data in TNC640?
Could you try any AI assistance like Chatgpt, google bard, or Microsoft Bing AI?
Probably one of them may help.

Testing on real machine

Hello,

I want to read machine data from a iTNC530.

I'm trying to connect to a iTNC530 using pyLSV2 using the code from the Usage section in the README

import pyLSV2
 con = pyLSV2.LSV2('192.168.56.101')
 con.connect()
 print(con.get_versions())
 con.disconnect()

I changed it so it connects to the correct IP-address, but when running the code I get the error NotImplementedError: this case for system parameters is unknown, please send log messages to add:

Looking further in this error I can see that it has to do with message_length == 124: # real machine? not tested!

Have you tested it on a real machine or do you have any advice as to how I could solve this problem ?

Thanks in advance!

How can I read the actual feed rate of spindle?

Hi @drunsinn
I want to read the feed rate of spindle. I modify the program to read the PLC data from address 2 to 1000.

Unfortunately,  I can see the actual feed rate on the device's screen, but nothing in plc data.

I think the actual feed rate change frequently,so it doesn't write into the plc.

How can I get that feed rate of spindle ?

Thanks very much.

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

image

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

How to locate Q parameters values

Hello everyone:

I am trying to locate a certain memory adress in the PLC of a Heidenhain TNC 640 but I can't.
My main problem is that I cannot make sense of the order in wich the read_plc_memory() method sorts the data.
For example:

I know I can find the PLC memory that I store in the machine as Q1620 using this line of code:

PN = con.read_plc_memory(first_element=250,mem_type=pyLSV2.lc.MemoryType.INPUT_WORD, number_of_elements=1)

The data I am looking for is stored in the Q107 in the machine.
Obviously there are not enough elements in the INPUT_WORD MemoryType to go from Q1620 back to Q107.
I guess it is stored in another MemoryType but I have not found it.

Maybe I could list all of the PLC values so i can search for it but I do not know how.
Can you please give me any tip?

Thanks in advance

iTNC 530 get_error_messages inconsistent?

Exercising get_error_messages on a iTNC 530 the logging/logic implies that getting to the "no next error" case is a negative and not a complete walk of the active error messages. This also seems like it is causing some unexpected behavior when run against the same machine when there are no errors.

getErrorMessages - Found an error message. Number: -2130706422, Text: 010 Machine guard is open !, Class: 3, Group: 3
2023-09-26 20:32:55 - LSV2 Client - INFO - edge1:3912516:client._send_recive - an error was received after the last transmission, Error Type: 1, Error Code: 57 'no next error available'
2023-09-26 20:32:55 - LSV2 Client - WARNING - edge1:3912516:client.get_error_messages - an error occurred while querying error information.

Case 2 log:
2023-09-26 20:32:56 - LSV2 Client - INFO - edge1:3912516:client._send_recive - an error was received after the last transmission, Error Type: 1, Error Code: 57 'no next error available'
2023-09-26 20:32:56 - LSV2 Client - WARNING - edge1:3912516:client.get_error_messages - an error occurred while querying error information.
.....
Skipping repeat logs
.....
2023-09-26 21:56:48 - LSV2 Client - WARNING - edge1:3912516:client.get_error_messages - an error occurred while querying error information. This does not work for all control types

Is the expected behavior for calling this method that we treat all "no next error available" errors as success message and if so, shouldn't the last_error be cleared instead of kept?

if self._llcom.last_response is lc.RSP.T_ER:

C-Sharp call Python

This pyLSV2 program works for me very well. Thanks all.
However, when I call this python program in c-sharp, I get an exception.
IronPython version is 3.4.0-alpha1 released on 2021-04-19
The message from “Microsoft.Dynamic.dll” is "'NoneType' object has no attribute 'close'".
The code as below:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Scripting.Hosting;
using IronPython.Hosting;

namespace ConsoleApplication1
{
class Program
{
private static string address = null;
private ScriptRuntime pyRuntime = null;
private ScriptEngine pyEngine = null;
private ScriptSource source = null;
private ICollection paths = null;

    static void Main(string[] args)
    {
        Program p = new Program();
        p.UsePython();
    }

    public void UsePython()
    {
        address = "192.168.1.37";
        System.Console.WriteLine("Connecting to {0}", address);

        pyRuntime = Python.CreateRuntime();
        pyEngine = pyRuntime.GetEngine("python");
        source = pyEngine.CreateScriptSourceFromFile(@"E:\JC\JCTest.py");

        ScriptScope scope = pyEngine.CreateScope();

        paths = pyEngine.GetSearchPaths();
        paths.Add(@"D:\Python\Python38\Lib");
        paths.Add(@"D:\Python\Python38\Lib\site-packages");
        paths.Add(@"E:\JC");
        pyEngine.SetSearchPaths(paths);

        source.Execute(scope); //  “System.MissingMemberException” in Microsoft.Dynamic.dll 
        System.Console.ReadLine();
    }
}

}

Can anybody help me? Thanks very much!

Cann't connect to the Haidenhain system (version TNC640)

Hi drunsinn

  I think there maybe something wrong in the program, or something configuration in the machine had been modified.

 One controller infomation of grob machine can be read from the program:
 Controller Information:
 TNC-Type:	TNC640
 NC-Version:	340590 10 SP2
 PLC-Version:	TNC640_V14.06.05

But the other controller infomation of HERMLE machine(C42U) can not be read suddenly。

This is an earlier result:
E:\pyLSV2-master\venv\Scripts\python.exe E:/pyLSV2-master/JCTest.py
Connecting to 192.168.1.37
{'Control': 'TNC640', 'NC_Version': '340590 10 SP3', 'PLC_Version': 'C42.33.04SP2HF1/S/'}

Connecting to 192.168.1.37
ERROR:root:something went wrong while waiting for new data to arrive, buffer was set to 256
Traceback (most recent call last):
File "E:/pyLSV2-master/JCTest.py", line 12, in
con.connect()
File "E:\pyLSV2-master\pyLSV2\client.py", line 94, in connect
self._configure_connection()
File "E:\pyLSV2-master\pyLSV2\client.py", line 229, in _configure_connection
self.login(login=Login.INSPECT)
File "E:\pyLSV2-master\pyLSV2\client.py", line 323, in login
if not self._send_recive_ack(CMD.A_LG, payload):
File "E:\pyLSV2-master\pyLSV2\client.py", line 206, in _send_recive_ack
response, content = self._llcom.telegram(
File "E:\pyLSV2-master\pyLSV2\low_level_com.py", line 122, in telegram
response = self._tcpsock.recv(buffer_size)
socket.timeout: timed out

an error occurred while querying system information

Hello,

I only use Fletransver for my programming and don't need any DNC or monitor functions, but I still get error messages (iTNC530 and TNC640)
The data transfer then works as desired

Can I deactivate the other logins somehow or what could be the problem?

con = pyLSV2.LSV2("172.29.48.126")
con.connect()
con.login(login=pyLSV2.Login.FILETRANSFER)

Console:

received unexpected response RSP.T_BD
an error occurred while querying system information on turbo mode
received unexpected response RSP.T_BD
an error occurred while querying system information on dnc mode
an error occurred while querying system information on axes samling rate

Thanks alot

Read values from PLC memory

Hey Max,

I want to read the PLC-memory to wait until a value changes using a WORD, MARKER or DWORD statement.

I sent a command that waits until the program state changes.

I've used the TNCcmd to send this statement and inspected it with Wireshark. I've found that it first makes a login with LOGIN_PLCDEBUG and then sends a command with R_MB (from PC to TNC) and get a response with S_MB (from TNC to PC)

I saw in the .client that the R_MB command was found via bruteforce test, purpose unknown but I didn't see the S_MB command.

Do you know a way how we can implement this reading of the PLC-memory in the code ?

Wouter

Originally posted by @WouterElfrink in #1 (comment)

Few question

Hi there,

I just discovered this lib, and I would be very interested in using it!

To try this lib I have on my computer "programming station itnc530 340 494 08 SP2"

However, I have a few questions:

first after the line con.connect() I have the following error:
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_WRONG_PARA, is that there is documentation that explains the errors.

secondly, what password should we enter in the line con.login(pyLSV2.Login.MONITOR,'password')?
is it located in the file: PLC:\OEM.sys?

compiling to .exe

Hello!

When I try to compile my script to .exe with py2exe, translations are not included. Any idea how to achieve to include translations (/locales folder).

problematic functions are:
get_program_status_text() and get_execution_status_text().

Thank you!

i cannot read all the plc variables

im trying to read this DWORD print("## Temp Motor Ax0: {}".format(con.read_plc_memory(7992, MemoryType.DWORD, 1))) and returns 0. but the correct value has 29000000, maybe because this is a local variable , and not global vaiavle?

Recive file in ASCII mode

HeLlo!

I own:
iTNC530, NC Software 606420 02 SP14 machine

I have another question. In the client.py > def recive_file :

with local_file.open('wb') as out_file:
            #file_buffer = bytearray()
            if response in self.RESPONSE_S_FL:
                # file_buffer.extend(content)
                if binary_mode:
                    out_file.write(content)
                else:
                    out_file.write(content.replace(b'\x00', b'\r\n'))
                logging.debug(
                    'received first block of file file %s', remote_path)

                while True:
                    response, content = self._llcom.telegram(
                        LSV2.RESPONSE_T_OK, payload=None, buffer_size=self._buffer_size)
                    if response in self.RESPONSE_S_FL:
                        # file_buffer.extend(content)
                        if binary_mode:
                            out_file.write(content)
                        else:
                            out_file.write(content.replace(b'\x00', b''))
                        logging.debug(
                            'received %d more bytes for file', len(content))
                    elif response in self.RESPONSE_T_FD:
                        logging.info('finished loading file')
                        break
                    else:
                        if response in self.RESPONSE_T_ER or response in self.RESPONSE_T_BD:
                            logging.error(
                                'an error occurred while loading the first block of data for file %s : %s', remote_path, self._decode_error(content))
                        else:
                            logging.error(
                                'something went wrong while receiving file data %s', remote_path)
                        return False

in while True: loop it should also be:

 else:
          out_file.write(content.replace(b'\x00', b'\r\n'))

Or am I wrong?

Thank you!

Program stalling

Hey Max,

I've got a question, when i'm connected to the machine and a program is running all is going ok. But when a sub-program is called the machine stalls. I can read that another program is called and the machine puts the tool away but after that it stalls.

The controls on the TNC don't work as well when this is happening

If I disconnect from the machine, the machine continues and works fine after that.

Do you know how this is happening ? Could it have something to do with a tool change or state change?

Thanks in advance!
Wouter

Edit:

I think it has something to do with the blocking mode of the socket.

Get error code

Hello!

Is it possible to recieve error code? I tried to read plc marker 4177 with this code:
print('PLC Marker PR Mode Error active: {}'.format(con.read_plc_memory(address=4177, mem_type=pyLSV2.PLC_MEM_TYPE_MARKER, count=1)))
which is True if there is an error. I would like to know what is error reason..

Thank you!

Machine PLC Restart on running LSV2_demo.py

I was trying out the LSV2_demo script and below is my output, i have got T_ER from the PLC and also the PLC had issues (restart), any idea on how to connect with the iTNC530 machine to gets the progam_status execution_status and spindle speed and spindle feed data

Connecting to "IP of the machine"
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_WRONG_PARA
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_WRONG_PARA
Connected to "iTNC530" with NC Software "*****"
Running LSV2 Version 1 with Flags 255
Drive Info: [(removed for security reason)]
Current Folder TNC:/ Free Space: 2085650432 Attrib: ['*', '*', '*', '*']
PLC Marker: [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
PLC Word: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
PLC Double Word: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
PLC String: [' ']
PLC Input: [False, True, False, True, True]
PLC Word Output: [0, 0, 0, 0, 0]
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_NOT_FOUND
WARNING:root:an error occurred while querying data path "\PLC\memory\D\7928". This does not work for all control types
PLC Double Word 7928: None
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_NOT_FOUND
WARNING:root:an error occurred while querying data path "\PLC\memory\K\1". This does not work for all control types
PLC Constant 1: None
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_NOT_FOUND
WARNING:root:an error occurred while querying data path "\PLC\memory\M\211". This does not work for all control types
PLC Marker 211: None
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_NOT_FOUND
WARNING:root:an error occurred while querying data path "\PLC\memory\B\7192". This does not work for all control types
PLC Byte 7192: None
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_NOT_FOUND
WARNING:root:an error occurred while querying data path "\PLC\memory\W\10908". This does not work for all control types
PLC Word 10908: None
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_NOT_FOUND
WARNING:root:an error occurred while querying data path "\PLC\memory\I\11". This does not work for all control types
PLC Input 11: None
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_NOT_FOUND
WARNING:root:an error occurred while querying data path "\PLC\memory\S\30". This does not work for all control types
PLC String 30: None
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_NOT_FOUND
WARNING:root:an error occurred while querying data path "\TABLE\TOOL\T\1\DOC". This does not work for all control types
DOC column of tool 1: None
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_NOT_FOUND
WARNING:root:an error occurred while querying data path "\TABLE\TOOL\T\1\L". This does not work for all control types
L column of tool 1: None
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_NOT_FOUND
WARNING:root:an error occurred while querying data path "\TABLE\TOOL\T\1\R". This does not work for all control types
R column of tool 1: None
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_NOT_FOUND
WARNING:root:an error occurred while querying data path "\TABLE\TOOL\T\1\PLC". This does not work for all control types
PLC column of tool 1: None
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_NOT_FOUND
WARNING:root:an error occurred while querying data path "\TABLE\TOOL\T\1\TMAT". This does not work for all control types
TMAT column of tool 1: None
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_NOT_FOUND
WARNING:root:an error occurred while querying data path "\TABLE\TOOL\T\1\LAST_USE". This does not work for all control types
LAST_USE column of tool 1: None
Current Language: 0
Current Program Stack: {'Line': 0, 'Main_PGM': 'TNC:/*****', 'Current_PGM': ''}
WARNING:root:T_ER or T_BD received, an error occurred during the execution of the last command: LSV2_ERROR_T_ER_WRONG_PARA
WARNING:root:an error occurred while querying current tool information. This does not work for all control types
Direct reading to current tool not supported for this control type. using backup strategy
Traceback (most recent call last):
  File "lsv2_demo.py", line 104, in <module>
    con.recive_file(local_path=str(local_recive_path),
  File "/pyLSV2-master/pyLSV2/client.py", line 846, in recive_file
    response, content = self._llcom.telegram(CMD.R_FL, payload, buffer_size=self._buffer_size)
  File "/pyLSV2-master/pyLSV2/low_level_com.py", line 118, in telegram
    response_length = struct.unpack('!L', response[0:4])[
struct.error: unpack requires a buffer of 4 bytes

Exception: AttributeError: module 'pyLSV2' has no attribute 'xxyyzzxxyyzz'

Hi :)
i'm just starting with pyLSV2. When I try to execute "lsv2_demo.py" i get following kind of errors. I tried to find where the mentioned attributes are defined but I did not have luck. I can't find where they are defined. Can anyone help?
Exception: AttributeError:
module 'pyLSV2' has no attribute 'PLC_MEM_TYPE_MARKER'
module 'pyLSV2' has no attribute 'PLC_MEM_TYPE_WORD'
module 'pyLSV2' has no attribute 'PLC_MEM_TYPE_DWORD'
module 'pyLSV2' has no attribute 'PLC_MEM_TYPE_STRING'
module 'pyLSV2' has no attribute 'PLC_MEM_TYPE_INPUT'
module 'pyLSV2' has no attribute 'PLC_MEM_TYPE_OUTPUT_WORD'
module 'pyLSV2' has no attribute 'LOGIN_MONITOR'
module 'pyLSV2' has no attribute 'KEY_MODE_MANUAL'

table_reader ERROR:NCTable parser:File has invalid utf-8 encoding

Hello,

I have an Error with some .t Tables:
ERROR:NCTable parser:File has invalid utf-8 encoding

I think the TNC format encoding is not utf-8

I change in table_reader.py line 302 from
with table_file.open(mode="r", encoding="utf-8") as tfp:
to
with table_file.open(mode="r", encoding="ANSi") as tfp:

and it works again
testet on iTNC530 and TNC640

thanks

Reading float values

Hi @drunsinn,

I can confirm that the lib works with iTNC530, 606420 02 SP3 quite nicely!

I am able to retrieve correct sensor values from the PLC memory as indicated by the addresses provided by the inventcom article (e.g. 322 milling head speed in revolutions/minute). Yet, so far I am only able to query Integer values. The machine does provide more sensor data, e.g. the milling head torque in Nm as decimals (at least I can see this from the TNCscope tool).

I do not know the specific PLC memory addresses for these values. So I tried reading all the adresses and interpreting them as float, yet this didn't bring up meaningful values anywhere. Doe you have an idea how I can convert the readouts correctly? So far, I am reading the DWORDs and convert them to floats using

value = con.read_plc_memory(address=x, mem_type=pyLSV2.MemoryType.DWORD,count=1)
flval = struct.unpack('f',value[0:4]) 

To do so, I had to change read_plc_memory() to directly return the payload, otherwise, I wasn't able to dissect plc_values further so that I could extract the raw byte data.

I hope I haven't overlooked something here. Thanks!

Sending file in ASCII mode - error

Hello!

I own:
iTNC530, NC Software 606420 02 SP14 machine

I am strugling with sending txt file (two blocks - more than 4096bytes) to the machine. If file is sent in binary mode everything is ok. When I try to send the same file in ASCII mode I recieve this error:

ERROR:root:could not send data with error T_BD

If file is small (only one block - up to 4096 bytes) both sending modes works ok.

Thank you!

Announcement of the discontinuation of the LSV2 protocol

Apologies if this enquiry is a little off-topic, but I suspect I've found the right specialists here.

I have been told that the LSV2 protocol has been discontinued and will no longer be available on newer CNCs in about 2-3 years.
The successor is the RemoTools protocol, but that seems to be a crappy Microsoft COM+ component.

Then there is an OPC UA server. It seems really intuitive, but it is only available for newer cnc. With this python opc ua toolkit I have already made first experiences in controlling a heidenhain CNC via OPC UA.

As far as I understood, I have two options:

  1. build a separate connection for old and new controls respectively:
    1a) old cnc = LSV2
    2b) new cnc = OPC UA
  2. write a Python wrapper for the RemoTools COM component and connect all controllers via it.

Does anyone have experience of using com components in python?
It seems incredibly complicated to me.

I am grateful for any tips.

Tool Call

Hello!

Is it possible to get information which tool is currently in use? Sam principle as getting the info about current running program.

get_program_stack()

Thank you!

I'm looking for the description or reason of each LSV2 protocol error numbers. Is there a document

class LSV2Err(IntEnum):

class LSV2Err(IntEnum):
    """Enum for LSV2 protocol error numbers"""

    T_ER_BAD_FORMAT = 20
    T_ER_UNEXPECTED_TELE = 21
    T_ER_UNKNOWN_TELE = 22
    T_ER_NO_PRIV = 23
    T_ER_WRONG_PARA = 24
    T_ER_BREAK = 25
    T_ER_BAD_KEY = 30
    T_ER_BAD_FNAME = 31
    T_ER_NO_FILE = 32
    T_ER_OPEN_FILE = 33
    T_ER_FILE_EXISTS = 34
    T_ER_BAD_FILE = 35
    T_ER_NO_DELETE = 36
    T_ER_NO_NEW_FILE = 37
    T_ER_NO_CHANGE_ATT = 38
    T_ER_BAD_EMULATEKEY = 39
    T_ER_NO_MP = 40
    T_ER_NO_WIN = 41
    T_ER_WIN_NOT_AKTIV = 42
    T_ER_ANZ = 43
    T_ER_FONT_NOT_DEFINED = 44
    T_ER_FILE_ACCESS = 45
    T_ER_WRONG_DNC_STATUS = 46
    T_ER_CHANGE_PATH = 47
    T_ER_NO_RENAME = 48
    T_ER_NO_LOGIN = 49
    T_ER_BAD_PARAMETER = 50
    T_ER_BAD_NUMBER_FORMAT = 51
    T_ER_BAD_MEMADR = 52
    T_ER_NO_FREE_SPACE = 53
    T_ER_DEL_DIR = 54
    T_ER_NO_DIR = 55
    T_ER_OPERATING_MODE = 56
    T_ER_NO_NEXT_ERROR = 57
    T_ER_ACCESS_TIMEOUT = 58
    T_ER_NO_WRITE_ACCESS = 59
    T_ER_STIB = 60
    T_ER_REF_NECESSARY = 61
    T_ER_PLC_BUF_FULL = 62
    T_ER_NOT_FOUND = 63
    T_ER_WRONG_FILE = 64
    T_ER_NO_MATCH = 65
    T_ER_TOO_MANY_TPTS = 66
    T_ER_NOT_ACTIVATED = 67
    T_ER_DSP_CHANNEL = 70
    T_ER_DSP_PARA = 71
    T_ER_OUT_OF_RANGE = 72
    T_ER_INVALID_AXIS = 73
    T_ER_STREAMING_ACTIVE = 74
    T_ER_NO_STREAMING_ACTIVE = 75
    T_ER_TO_MANY_OPEN_TCP = 80
    T_ER_NO_FREE_HANDLE = 81
    T_ER_PLCMEMREMA_CLEAR = 82
    T_ER_OSZI_CHSEL = 83
    LSV2_BUSY = 90
    LSV2_X_BUSY = 91
    LSV2_NOCONNECT = 92
    LSV2_BAD_BACKUP_FILE = 93
    LSV2_RESTORE_NOT_FOUND = 94
    LSV2_DLL_NOT_INSTALLED = 95
    LSV2_BAD_CONVERT_DLL = 96
    LSV2_BAD_BACKUP_LIST = 97
    LSV2_UNKNOWN_ERROR = 99
    T_BD_NO_NEW_FILE = 100
    T_BD_NO_FREE_SPACE = 101
    T_BD_FILE_NOT_ALLOWED = 102
    T_BD_BAD_FORMAT = 103
    T_BD_BAD_BLOCK = 104
    T_BD_END_PGM = 105
    T_BD_ANZ = 106
    T_BD_WIN_NOT_DEFINED = 107
    T_BD_WIN_CHANGED = 108
    T_BD_DNC_WAIT = 110
    T_BD_CANCELLED = 111
    T_BD_OSZI_OVERRUN = 112
    T_BD_FD = 200
    T_USER_ERROR = 255

Can we get the symbol name through the PLC address?

Hi drunsinn
Our customer have one HERMLE C42U and one GROB G552 with HEIDENHAIN TNC640 NC system.

       Hermle had changed PLC password, but the Grob never.

       I had used the 'foolish' method to find the value which is shown on the screen when the spindle work. 

       The python program is ok and we can get all the value in the PLC. I write a few code as below:

      '''
      for num in range(0, 22000, 4):
         print('{}'.format(num), end='')
         print(con.read_plc_memory(address=num, mem_type=pyLSV2.MemoryType.DWORD, count=1), end='')
         print('\t', end='')
         if num % 40 == 0:
             print('')
      '''

      I had found that the value also has a symbol name at the same time. Can we get the PLC value and the symbol name at the same time? 

      That is an example : D4448: APICHN[0].NN_CHNCONTOURFEED and D39096 STG_SPINDELKOMP.DG_SPINDELDREHZAHL

      First, I want to get the symbol name through the PLC address.

      And the second, I get the PLC address value through the symbol name.

      Thank you very much!

unexpected response 'RSP.T_BD'

Hello,

I try to send data (normal .H) with send_file, binary_mode=False on a "iTNC530 60642002 SP10" (the same code works on a TNC640)
could not send data, received unexpected response 'RSP.T_BD

The Heidenhan Doc says "Blockübertragungsfehler" (sorry German)
Die Fehlernummern 100 - 199 sind Blockübertragungsabbruchfehler (T_BD)

con.last_error() repeats also an Error :(
Traceback (most recent call last):

  File "h:\python\pyLSV2\pyLSV2 test Datei.py", line 28, in <module>
    con.last_error()
TypeError: 'LSV2Error' object is not callable

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.