Zuviel Werbung? - > Hier kostenlos beim SPS-Forum registrieren

Ergebnis 1 bis 6 von 6

Thema: AdsAPI

  1. #1
    Registriert seit
    01.04.2009
    Beiträge
    4
    Danke
    2
    Erhielt 0 Danke für 0 Beiträge

    Standard


    Zuviel Werbung?
    -> Hier kostenlos registrieren
    hello people!

    i am trying to implement an ADS library for linux. I would prefer that this library had the same API than the oficial API, implemented by AdsAPI.h and AdsDEF.h .

    My main problem now, since i found everything +/- implemented in a libads that i found in this forum, is to understand the way connections are handled.

    mainly the portOpen/ portClose functions.

    every command must have a new connection?

    *pseudo code*
    portOpen

    send command

    receive response

    port close
    *end pseudo code*

    or this has to do with with some connection management inside AdsDLL.dll?

    thanks
    Zitieren Zitieren AdsAPI  

  2. #2
    Registriert seit
    24.04.2008
    Ort
    Lübeck
    Beiträge
    324
    Danke
    8
    Erhielt 64 Danke für 62 Beiträge

    Standard

    The hole connection is handled by the Tcp/Ip protocol. Ads has no specification to manage the connection.

    Only connect to the port 48898 with a Tcp/Ip-Socket and send/receive your commands. You have not to close the connection with every command and open a new port.

  3. Folgender Benutzer sagt Danke zu Neals für den nützlichen Beitrag:

    gass (07.04.2009)

  4. #3
    gass ist offline Neuer Benutzer
    Themenstarter
    Registriert seit
    01.04.2009
    Beiträge
    4
    Danke
    2
    Erhielt 0 Danke für 0 Beiträge

    Standard

    i know that i just have to connect to that port.
    my problem is that i have an portOpen and a portClose functions that i don't know what they do.

    and, i don't want to open a new connection everytime i want to comunicate to other machines. Or, at least, i think that way.

    thanks

  5. #4
    Registriert seit
    19.06.2003
    Beiträge
    2.200
    Danke
    85
    Erhielt 259 Danke für 175 Beiträge

    Standard

    Gass, I saw you published my older sources and examples elsewhere.
    At the moment, I cannot even find them myself
    I attach here newer versions of the core files ADS.c and ADS.h.
    The new stuff is that they can receive and answer messages a BC9000 sends when programmed to do so.
    I just use them in my SCADA/HMI.
    I did not compile them to libads.so nor test them with the older examples.

    [quote gass]
    my problem is that i have an portOpen and a portClose functions that i don't know what they do.

    and, i don't want to open a new connection everytime i want to comunicate to other machines. Or, at least, i think that way.
    [/quote]
    You may have found out that yourself:
    If you want to read data continuously, just open the connection once. Then do your read loop.
    Close the connection when your program ends.
    Try to close and reopen the connection if some error occurs.
    Angehängte Dateien Angehängte Dateien

  6. #5
    gass ist offline Neuer Benutzer
    Themenstarter
    Registriert seit
    01.04.2009
    Beiträge
    4
    Danke
    2
    Erhielt 0 Danke für 0 Beiträge

    Standard

    thanks for you answear and code.

    i have my source code here:
    http://github.com/gass/libads/tree/master

    i will provide 2 libraries:
    - libads - basically your library (i have changed some code, because it was not working)
    - libadsApi - oficial beckhoff ads API compatible library

    i will check your source code agains the one i have and check the diferences.
    if you are interested, i will keep my code compatible with the one you provided so you can reuse it, or even use the library in your applications without change.

    About the connection, my problem is with the ADS API, since it needs an "ADS router". The ads router concentrates all connections from and to the beckhoff hardware so it can only comunicate with it once at a time.

    thank you.

  7. #6
    Registriert seit
    19.06.2003
    Beiträge
    2.200
    Danke
    85
    Erhielt 259 Danke für 175 Beiträge

    Standard


    Zuviel Werbung?
    -> Hier kostenlos registrieren
    Gass, I did not see your answer before, this is why I did not reply earlier.
    When my interface differs from official BECKHOFF API, the reason is this:
    After writing Libnodave and after implementing some other PLC interface (e.g. libOpenSRTP, for GE Fanuc), I sought for a "least common denominator". This would allow users to exchange functions from one of these libraries for those from any other in order to make their applications work with another PLC brand/protocol. We may discuss that further if you are interested.

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •