AngryRobot

Comparing Time Of Day with an NJ Processor

5 posts in this topic

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.

Share this post


Link to post
Share on other sites

Like this:

wONRPFpkbMpUQAAAABJRU5ErkJggg==

or if you want to use a variable in the comparison, like this:

A8KNphu+abPUAAAAAElFTkSuQmCC

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. 

Share this post


Link to post
Share on other sites

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.  

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now