Beckhoff ADS in go (golang)

324 views
Skip to first unread message

Jonathan Svensson-Köhler

unread,
Sep 25, 2013, 3:10:56 AM9/25/13
to beckhof...@googlegroups.com
Hey guys!

I have started work on a ADS lib in go. You can find it here: https://github.com/stamp/goADS

Currently i have implemented the following:
  • ReadDeviceInfo - ADS command 1
  • Read - ADS command 2
  • SymbolUpload (and structs)
  • Read for uploaded symbols (you can read a whole struct at once)

If somebody is interested in helping out or how to use it. Please feel free to contact me or write your feedback here.

Here is an example

// Connect
    connection,e := goADS.Dial(*ip,*netid,*port)
    defer connection.Close(); // Close the connection when we are done

    if e != nil {
        logger.Critical(e)
        os.Exit(1)
    }

// Read device info
    data, e := connection.ReadDeviceInfo();
    if e != nil {
        log.Critical(e)
        os.Exit(1)
    }
    log.Infof("Successfully conncected to \"%s\" version %d.%d (build %d)", data.DeviceName, data.MajorVersion, data.MinorVersion, data.BuildVersion)

// Upload symbols and structs
    symbols,_ := connection.UploadSymbolInfo()

// Search for symbol
    pd,ok := symbols[".SYSTEMTASKINFOARR"]

// If we found it..
    if ok {
        // Read (and parse) values from plc
        pd.Read()

        // Print all values
        pd.Walk()
    }
  
Reply all
Reply to author
Forward
0 new messages