TozoM8 Posted October 21, 2019 Report Share Posted October 21, 2019 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! Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted October 21, 2019 MVP 2022 Report Share Posted October 21, 2019 Did you try the HMI element called "Time Function"? Quote Link to comment Share on other sites More sharing options...
MVP 2022 Joe Tauser Posted October 21, 2019 MVP 2022 Report Share Posted October 21, 2019 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. Quote Link to comment Share on other sites More sharing options...
TozoM8 Posted October 21, 2019 Author Report Share Posted October 21, 2019 Thank you. I will try tomorrow. Quote Link to comment Share on other sites More sharing options...
TozoM8 Posted October 22, 2019 Author Report Share Posted October 22, 2019 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 Quote Link to comment Share on other sites More sharing options...
TozoM8 Posted October 29, 2019 Author Report Share Posted October 29, 2019 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? Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted October 29, 2019 MVP 2022 Report Share Posted October 29, 2019 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. Quote Link to comment Share on other sites More sharing options...
TozoM8 Posted October 29, 2019 Author Report Share Posted October 29, 2019 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) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.