Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About Set/Get PLC time function #42

Open
whitetiger21022014 opened this issue Dec 24, 2020 · 2 comments
Open

About Set/Get PLC time function #42

whitetiger21022014 opened this issue Dec 24, 2020 · 2 comments

Comments

@whitetiger21022014
Copy link

Hi Robinson,
PGClockWrite (implement GetPLCDateTime) , is it a mistake between 2 functions?

//implement GetPLCDateTime
func (mb *client) PGClockWrite() (datetime time.Time, err error)

//implement SetPLCDateTime
func (mb *client) PGClockRead(datetime time.Time) (err error) {

@zhangzijie-820
Copy link

hi when you use PGClockRead to set time of plc,do you produce a panic?

@arhray
Copy link

arhray commented Dec 22, 2023

I believe there are multiple issues in datetime.go
PGClockRead / PGClockWrite function names are reversed - just confusing
mb.send does not catch error and so will panic if PLC is disconnected
s7.SetDateTimeAt(requestData, 32, datetime). I had to change this to s7.SetDateTimeAt(requestData, 31, datetime) to format date correctly.

PS. I am new to github. Happy to post my fixed datetime.go if required
PPS. Great job with gos7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants