Siemens S7/TIA v16: What memory address should I use for a pushbutton on the HMI?...

you need to show a bit more code, it is difficult to see what you are trying to do but to start with it is not usual to write the code in OB1, you create a program block FC (or is it an FB) so long I cannot remember, there you write the code & call it in OB1, you split the program into manageable sections like:
FC1 Analogues
FC2 Digital input map
FC3 Digital output map.
FC4 Laser Data manipulation
FC5 Motor calls
FC6 Valve calls
FC7 Main sequence program
& so on
Then call those blocks in OB1 either unconditionally or conditionally if they only need to run when certain logic is required.
TIA like Mitsi (GXWorks), AB, etc. are designed for structured programming so rather than have one big block of code you split it into different programs.
It also makes sense that if you have motors or valves etc. to create functions like motor or valve control, these are only written once then you call them many times passing information to them the block will have input & output parameters so everytime you call the block you populate it with the relevant signals for that valve, this way you only write the code once but call it many times.
See pic of a structured program
Many thanks for this - I will need some time to digest it. There's a lot in there.

As for my code...it's all in OB1 at the moment.
Networks 2 to 10 are a repeat of Network 1, for each laser.
Then Network 11 does a SAVE of the values to retained tags defined in a DB.
That's all the code I've done so far.
See the 2 pics.

H Network 1.png J Network 11.png
 
you need to show a bit more code, it is difficult to see what you are trying to do but to start with it is not usual to write the code in OB1, you create a program block FC (or is it an FB) so long I cannot remember, there you write the code & call it in OB1, you split the program into manageable sections like:
FC1 Analogues
FC2 Digital input map
FC3 Digital output map.
FC4 Laser Data manipulation
FC5 Motor calls
FC6 Valve calls
FC7 Main sequence program
& so on
Then call those blocks in OB1 either unconditionally or conditionally if they only need to run when certain logic is required.
TIA like Mitsi (GXWorks), AB, etc. are designed for structured programming so rather than have one big block of code you split it into different programs.
It also makes sense that if you have motors or valves etc. to create functions like motor or valve control, these are only written once then you call them many times passing information to them the block will have input & output parameters so everytime you call the block you populate it with the relevant signals for that valve, this way you only write the code once but call it many times.

You're probably over-complicating this a bit while OP is still familiarising with TIA.

Using FC's isn't a necessity, although it can be helpful as you say.
You can also partition the program off into many different OB's to keep it into bite size chunks. The one Mitsubishi PLC we have on site is all programmed as one huge lump of code and it's a complete nightmare to navigate.

Possibly worth experimenting with creating an analog FC though, rather than sorting out the NORM_X and SCALE_X for every input and output.
 
@Puddle:
That's probably just because it was programmed in either Medoc or GXDeveloper, Even GXDeveloper can be segmented but not many people know how to do it & it is still only in one long list of instructions, the only difference is there will be a FEND instruction then a number of END instructions for each of the calls, GXWorks or the older GXIEC was structured but to make it compatible with the older platforms you have to either download the symbolic code or at least keep a backup copy.
I do remember many years ago early 1980's I did my first siemens S5 on a 101U brick, only had the handheld so just put everything in OB1, it was quite a large program & when we got our first PG675 I uploaded it but it would not accept it as ladder because the limit on S5 was 255 segments & 255 instructions per segment, ended up with a long list in STL so ended up putting the segment end in after what would have been each ladder end, (BLD255) segment end it then allowed me to display it in ladder, S5 was limited to 255 DW per DB in normal programming however, there was a 20 bit addressing where a DB could be as large as required you could not directly use the addresses in S5 like L DW1234 had to find the 20 bit address & load that to access them (Not for the faint hearted). a little bit like using the P# pointers in S7.
Mas01 really needs to understand the S7 system for future projects so that he can use the functionality the way it is intended, in the end it makes sense.
I was an approved Siemens system integrator but since I retired my exposure to S7 has been limited to mainly Step7 5.5 I do have TIA but a very early version that will not run on Win11 so have not really looked at it.
 
Mas01 really needs to understand the S7 system for future projects so that he can use the functionality the way it is intended, in the end it makes sense.
I was an approved Siemens system integrator but since I retired my exposure to S7 has been limited to mainly Step7 5.5 I do have TIA but a very early version that will not run on Win11 so have not really looked at it.

I think there's a lot to learn on TIA, there's a thousand ways to achieve the same ends. I ended up spending the time to teach myself proper use of FB's after nearly filling the memory of a 1211 CPU and realising I'd created a monster for the next person who tried to amend that program.
I think I'd be going slow if I had to sit down and learn Allen Bradley or Mitsubishi having spent all my time on Siemens.

Siemens now call Step7 "S7 Classic" and still run courses on it. Not sure if you can still do the certification exam on it, as the course says it's run on TIA. I'd love to do the certification myself, but I know my company absolutely wouldn't be paying for an exam resit and it's meant to be quite challenging, so I'm putting that off until I feel like I have a good chance of passing.

In terms of TIA, Siemens themselves say that anything before v13 isn't stable enough to use.
 
Yep, although Siemens have had the basic concept of FB's since the late 70's it was probably one of the first, certainly more advanced than most. although in those days FB's could only be programmede in STL the only things that have changed are the ability to program FB's/FC's in ladder or FBD, & the use of instance DB's etc. In my day even though there were manuals that showed the main opcodes/instructions there were some that did not seem to be documented, I was fortunate to work with an ex siemens guy from Germany, he showed me some of the more obsure instructions/ways to program, for example how you could put the S5 opcodes (MC5) hex values into a DB & by using special instructions use the DB as the actual code, very dangerous as it was possible to alter the effective code during running.
So in reality, TIA is just an upgrade of Step 7 to comply with & probably enhance the IEC convention. And of course keep up with trands like communications, special cards where you configure the card rather than create your own code i.e. Analogues etc.
I loved programming in STL & used it almost exclusively I worked mainly on the 155 PLC's these were monsters, just the main rack plus memory, Coms for H1 & 232 & the old Graphics (WF470) would cost over Ā£50,000 then you add the I/O perhaps 7 or 8 extention racks.
Actually, AB & Mitsubishi is something I found pretty easy, although it became more difficult to do some really clever programming as it is not as flexible as siemens & Mitsubishi documentation although not poor in content the translation what I called Chinenglish made it more difficult to understand.
I'm getting old so my brain does not work as fast as it did so learning new systems becomes a little more difficult.
 
Last edited:
So in reality, TIA is just an upgrade of Step 7 to comply with & probably enhance the IEC convention. And of course keep up with trands like communications, special cards where you configure the card rather than create your own code i.e. Analogues etc.
I remember when TIA portal was pretty new (V11 maybe). One advantages to step7 which was even noted was ability to save blocks with errors. šŸ™ƒ
 
some years ago, our systems were upgraded from XP to win 7, Step7 V5.3 would not install, called our main supplier & they reccomended upgrading to TIA, expensive but thought it would be a good idea we only had 300's & 400's at that time.
Turns out that our hardware was not supported in TIA for mods or download you could open the project & go on-line but not make modifications, called supplier but as it had been opened they would not exchange it so ended up having to buy S7 V5.5 doh...
 
Might be of interest to you.
sometimes if the HMI or Coms are busy it is possible that the pressing of the store button is not seen, this has happened to me so what I do is run a TP timer as shown & use the output to enable a message on the screen for say 3 seconds, this gives the operator confirmation that the save button has been pressed & seen in the PLC. The TP timer only requires a transition from false to true, the output then comes on for the preset time then goes off, use the output to display a message on the HMI I tend to make it flash so it is obvious.
It's just using the bit to make the message visible while true.

Stored Message.png
 

Similar Topics

In OB1, I'm monitoring some values (first pic). The values are what I expect. At the same time, I'm monitoring the same values in the DB where...
Replies
1
Views
651
Siemens S7/TIA v16: "Overwrite if object exists online?" HMI loading message... Thus far, I've just been ticking this box, just to get the HMI...
Replies
4
Views
769
I'm having a bad day. Daft question coming up...Anyone know why I can't add anything into this DB? Add button is greyed-out. Thanks
Replies
14
Views
1,597
I imported a customised shape into the project, but I don't know how to actually add into on to a specific HMI screen. Do I use the Graphics menu...
Replies
2
Views
661
Hi I'm trying to display a value on the HMI. In monitor mode on the code, I can see that value, but on the HMI , after downloading, it is...
Replies
10
Views
948
Back
Top Bottom