AngryRobot Posted June 8, 2016 Report Posted June 8, 2016 I need to look at the time of day and reset a value at midnight. I have extracted the time into a Time_Of_Day tag; but how do I compare that to my set time of 00:00:00.00? I tried creating my own time of day variable but I cannot figure out how to move a value into it. Quote
Michael Walsh Posted June 8, 2016 Report Posted June 8, 2016 Like this: or if you want to use a variable in the comparison, like this: I am not sure, but if your task period is >1ms, then you may need to worry about using something other than the = function, perhaps the ZoneCMP instruction where you can specify a min and a max for the range and then use a leading edge one shot of the result. Or you could check to see if the TOD is less than 00:00:01.000 and do a leading edge one shot of that. Quote
AngryRobot Posted June 8, 2016 Author Report Posted June 8, 2016 Thank you! It was the TOD# designation that I was missing. I just could not for the life of me figure out how to write a time value to my variable... and that solved it! You are the NJ master man. Quote
Michael Walsh Posted June 8, 2016 Report Posted June 8, 2016 A little tip: I had to look this up to make sure that I had the correct format. One of the manuals that is installed with Sysmac Studio has all the formats located in it, but rather than look it up in the manual, I just looked for Time Of Day functions (TOD) in the Toolbox and then looked at he help file (F1) for one of the instructions. It showed the constant format in the help file. Quote
AngryRobot Posted June 8, 2016 Author Report Posted June 8, 2016 I should have figured that out, because I saw the TOD listed as the output type in the variable table of the help file for the DT_TO_TOD instruction. It just never occurred to me to add it with the # sign before my values. It should have though, since I have a boatload of REAL# values strung out through this program. I just didn't put two and two together. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.