Jump to content

Recommended Posts

Hi again. 
I am trying to figure out how to calculate off time.  If I use SI31 I can display the current time. Every time the machine is running I have a TA timer counting up.  I want to deduct 6 hours of the SI31 (production shift starts at 6:00am) but when I deduct 600 it will display as an MI eg. 7:15 will be 115. How can I display that it time as 1:15?

Thanks in advance!

Share this post


Link to post
Share on other sites

You need to break your 115 into two pieces, 1 and 15, and display them separately separated by a ":".   All you need to do is divide your accumulated time by 100 to get hours and then immediately move the remainder (SL 4) into another register for minutes.

Use leading zeros on the minute register.

If you post your code and tell us which register is the off time (containing 115) I'll hack it in for you.

Joe T.

Share this post


Link to post
Share on other sites

Time function was a no go. It shows 0:2E instead of 2:30

Joe's suggestion worked. I had to use leading spaces on the hour display otherwise it looks like this 2  :30

Share this post


Link to post
Share on other sites

So with the data table I can show current date, current time, (RTC To ASCII)

then I deduct 600 (6 hours) from SI 31 to an MI

then with Num To ASCII I can Plug that MI  into the data table. These all work.

Now I have to figure out how to plug in the machine run time. I have a TA preset to 24:00:00;00. On the plc screen I have that timer set as type current, display elapsed  and after 12 min , it will show 12 min on the plc and 23:48:00;00 on the ladder timer.  With the T To ASCII it will show 00:00.  What  would be correct was to have the machine run time in the data table?

Share this post


Link to post
Share on other sites

Tozo, perhaps you need to change tack and consider using UTC.  Storing UTC under certain parameters being met, and then doing compares when others are met lets you arrive at intervening times very easily. 

For OFF time, on initial start you simply do a compare to a stored UTC that is updated every second during normal running, and then derive the time from the result.  You might be surprised at how useful UTC is against RTC in some instances.

cheers, Aus.

Share this post


Link to post
Share on other sites

So as it turns out T-> ASCII works. 

T->
A-TA (only runs when machine is on)

B-(offset in vector=0)

C-HH:MM

E-(elapsed)

ASCII

MI to column type string (length 10)

Reset TA when SI32 is different from stored. (stored when they start the machine)

 

Share this post


Link to post
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.

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