Skip to content

ilove737/go-snap7

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-snap7

package main

import (
	"fmt"

	s7 "github.com/ilove737/go-snap7"
)

func main() {
	Client := s7.Cli_Create()
	Client.Cli_ConnectTo("127.0.0.1", 0, 2)
	CP := Client.Cli_GetCpInfo()
	fmt.Println(CP.MaxPduLengt)

	CPU := Client.Cli_GetCpuInfo()
	fmt.Println(CPU.ModuleTypeName)

	fmt.Println(Client.Cli_GetExecTime())

	var wdata []byte
	for i := 0; i < 48; i++ {
		wdata = append(wdata, byte(i))
	}

	Client.Cli_DBWrite(1, 0, 48, wdata)

	fmt.Println(Client.Cli_DBRead(1, 1, 32))

	Client.Cli_MBWrite(1, 20, wdata)
	fmt.Println(Client.Cli_MBRead(1, 20))
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published