Siemens S7-1200 Tia Portal help

pedroborges

Member
Join Date
Aug 2022
Location
Portugal
Posts
17
Good,

Code Totalizer:

IF ( Hour = 23) and ( Minute = 59) and ( Second = 59) THEN
totalizerDay_previous : = totalizerDay;
totalizerDay= 0;
End_IF

-------------------

I want to move the value from day's totalizer to previous day's totalizer at 23:59:59 (hour/minute/second). the code is not working, whenever I move the value from the totalizer of the day to the totalizer of the previous day it moves the zero value instead of moving the current value of the totalizer of the day
 
Your If statement will be true for 1 second which will result in totalizerDay being zero when Second eventually becomes zero. Use a rising edge.
 
Don't know ST in Siemens but have done this before

IF ( Hour = 23) and ( Minute = 59) and ( Second = 59) AND NOT(One_Shot)THEN (* Add a oneshot bit*)
totalizerDay_previous : = totalizerDay; (*Copy the data *)
totalizerDay= 0;
One_Shot := TRUE; (* Set the oneshot bit *)
ELSE;
IF (Second <> 59 ) THEN (* When the second register is not 59 reset the oneshot bit *)
One_Shot := FALSE;
END_IF;
END_IF;
 
Last edited:
And we're all assuming this is running in OB1 or an OB that runs more frequently than a second.



If Hour, Minute and Second come from the PLC clock and you want to move the day's total to a variable, I'd instead use a time of day interrupt.



See here how to do it. No logic, just set it up correctly and add an instruction TotalizerDAy := 0; inside it.
 
And we're all assuming this is running in OB1 or an OB that runs more frequently than a second.



If Hour, Minute and Second come from the PLC clock and you want to move the day's total to a variable, I'd instead use a time of day interrupt.



See here how to do it. No logic, just set it up correctly and add an instruction TotalizerDAy := 0; inside it.
Good solution, but no link or attachment.

Add New Block > Organization Block > Time of Day interrupt
After creation, right click > properties and set it to run daily at 23:59:59
 
I would put this in an time-of-day interrupt OB and run in once every 24 hrs.
 

Similar Topics

See the attached pic ("workflow"). I want to create 2 workflows, depending on if the person who's just logged in is an OPERATOR or an ADMIN...
Replies
17
Views
2,478
I am trying to upgrade an old Siemens S7-1200 PLC that has a program on in written in version 13 of TIA Portal. I am going to write a totally new...
Replies
2
Views
1,702
I need to convert some Siemens PLC logic using Siemens TIA V16 to Modicon M580 logic. Is there a tool out there that will get me started? How...
Replies
3
Views
2,691
I have been using TIA portal 13 for several projects HMI. The HMI is 1200 panel. On the previous project, I could connect to the PLC and use...
Replies
26
Views
18,735
Hi all, Quick question. I have an alarm block in my 1200 PLC with multiple alarm inputs declared as bits. Say db500.dbx0.0 to dbx3.7 I have a...
Replies
6
Views
3,896
Back
Top Bottom