# 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

##### 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)

##### Share on other sites

• MVP 2022

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.

##### Share on other sites

Many thanks for your help.

Yes, the solution was to use the function NUM to BCD.

Now I can compare the current time to a MI variable.

Regards

Otto

## 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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×