Jump to content

How to use a time function with an MI (Memory Integrer), and get a decimal display?

Recommended Posts

I create a timer with MI (Memory Integrer) and MB (Memory Bits) and then I tried to display  the current value with the time function. Problem is : the display of the timer is a hexadecimal value.  I tried to use others function like "UTC to RTC" or "Numerics" but I don't know how to get the display of the current time and the elapsed time of the timer I made. 

Wanted display :  HH : MM : SS (decimal value)

The timer look like :

MI 1 : Preset

MI 2 : Current

MI 3 : Elapsed

And there is others nets to manage the proper functionning of the timer.

I know that it's possible to use the basic timer already set in the PLC but I don't want to use them.

Link to comment
Share on other sites

  • MVP 2023

It's hard to make sense of what you're trying to do. There is an HMI Timer display that will display an actual timer in any format you choose. If you want to copy the timer preset or current into an integer register, use the Load Timer/Counter Preset or Load Timer/Counter Current functions. For those, I recommend that you use an ML rather than an MI since the Preset and Current are in units of 10ms.

If you are trying to manipulate clock time, then there are System Integers (SI) that have the hours, minutes, and seconds already separated for you.

Link to comment
Share on other sites


There is above the timer that I have created. As  you can see ther is a MB for the start and the end of the timer, the current value ant the preset display on a HMI Diplayer. There is no problem for me to write from the PLC, a value for the preset, but at the end of the process the displayed time is in hexadecimal base. I don't know how to diplay the time in a decimal base.1436327862_Valeurdepreselection_courante_coul.PNG.21964a8ec3617fc50c72084734769a75.PNG           This is how I have create the elapsed time.


This is the HMI where I want the display of thee three two times (current, preset)


But the display is in hexadecimal base, not decimal.

I hope I have dealt with most of the issues you have raised. And I didn't think about using ML so I will replace the MI and ML. For the increment I prefer to use the bit SB3 that I store in MB 5.

Link to comment
Share on other sites

  • MVP 2023
4 hours ago, Foucault said:

For the increment I prefer to use the bit SB3 that I store in MB 5.

Why?  Use SB13 directly.

If you are using the variable numeric for the display, you have likely selected Hex instead of Decimal in the Base Format.

Essentially you are creating a counter that is based on a 1 sec pulse, which allows the easy manipulation you want.  I often say on the forum that counters can do some jobs much better than timers.  Learning the abilities of the controller and how to do it is part of the PLC learning curve, which often means focussing on one simple concept to learn it completely and then progress to the next, finally combining them all successfully into your working program.

Link to comment
Share on other sites

Ok thank you for those details. Like I said earlier about SB 3, the programm I'm writing will be use by other people who prefer to use other software, therefore the conversion between softwares will be composed of MB and MI only (or ML).

And I find how to display a decimal value in the tme function box: use the ladder fonction "NUM TO BCD", so it finally works normally. So the topic has a been resolved =D

Thank you all for your help ; )

Link to comment
Share on other sites

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 link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

  • Create New...