Jump to content

System Integer – Memory Integer


Recommended Posts

Hello,

I’m new with VisiLogic. I have to compare a MI and a SI value.

In fact I don’t understand why I have in a HOUR function a big value in MI “to” time and a small value in SI 31 for “System time” for the same time?

Example: I have to switch something off at 23:15. The MI show in debug the value 8981, but the SI 31 shows me for 23:14 the real time like 2314!

How can I compare this two value?

Regards

Otto

post-176-0-09806500-1349472170_thumb.jpg

Link to comment
Share on other sites

  • MVP 2014

Firstly, to answer your immediate question, the HOUR function and SI31 use a different format. SI31 is simple decimal representation, whilst the HOUR function uses a BCD format. See the help file for details.

Changing the display format on your HOUR MIs to HEX should make it look right, but that still won't allow you to use a direct compare function, which leads to the second point:

You don't need to perform a manual comparison when the indirect clock functions will do this for you (search "indirect clock" in the help).

If you still have a reason to use the manual comparison, I think the BCD to NUM function would work to convert the indirect clock format to system time, or the NUM to BCD would convert the system time to indirect clock format (but I haven't tested this)

Link to comment
Share on other sites

  • MVP 2023

As usual, I read the other post first and replied before reading this one.

Otto - do you need the ability for the operator to change the value in MI 151? As Simon pointed out, SI 31 is in its own format: HHMM. This is not a standard conversion from anything but rather a way to display the time in an easily human-readable way.

If you need to set this time from within your program then you need to have separate MIs for hours and minutes. Multiply the hour MI by 100 and add it to the minute MI - the result will be in the format needed to compare to SI 31.

Joe T.

Link to comment
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
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.