Siemens HMI-PLC Communication

Jieve

Member
Join Date
Feb 2012
Location
USA
Posts
274
Hello all,

I am working on programming one of the PLC training modules we have at my work. It is a relatively simple assembly line model controlled by a Siemens S7-300 and a couple digital signal modules which control pneumatic solenoid valves. Connected to this system is an operator panel OP177B via Profinet, programmed with WinCC Flexible Advanced. I have created buttons on the operator panel for operation in manual mode, and can change the acquisition time associated with each tag (data block bit) linked to each button. A few questions:

1) I don’t exactly understand the process by which the PLC communicates i.e. sends/receives information to the operator panel (the process of the OP reading and writing data block bits to the data blocks via profinet). Can anyone explain how this works?

2) I have observed (at least it seems to be the case) that data block bits linked with buttons on the operator panel are updated based on the acquisition time specified in the tag details. I have a situation in my mode selection code where I say “if x conditions and jog bit not set, then manual mode” and in another network, “if x conditions and jog bit set, then jog mode” (the jog bit is toggled by an operator panel button). If these OP buttons were normal hardwired switches/buttons this would be fine, since their values would be read once at the beginning of the cycle and there would be no way for both modes to active at the same time. However, if the jog bit can be changed in the middle of the program by the operator panel, the situation could arise where during one scan both modes are active. Are the bits modified by OP buttons during a cycle be changed in the middle of the cycle? And if this is the case, is there a way to change this so that data block bits connected to buttons from the OP are only read once at the beginning of each scan, like a normal input?

Thanks for any info.
 
I don't know the answer to the first but I have included sample code to take care of the second. I really don't think it would change between scans, but never know, so to always be sure always lock out two, three, four etc conditions you don't want to happen simultaneously together. The code attached in pdf format is the simplest way to do it.
 
Thanks for the response.

The code in the pdf file would be fine (it's pretty much how I was doing it) if the jog button were an actual hardwired input and not an HMI button. The problem is that the button is linked to a data block bit, meaning it could change at any moment in the program, not just at the point that the plc reads the inputs. If in the off chance that the "jog button" bit changed between between those rungs, both manual mode and jog mode would be active at the same time. This is exactly the problem I'm trying to find a solution to.

One method would be to link the button to two data block bits, one that registers when the button was pressed, and the second data block bit is assigned to the first at the beginning of the program. Then only the second data block bit is actually used in the code. However, I was told that this shouldn't be done.

Any other ideas on how this should be done?
 
Hi!
Could you use f.x. a byte value to control both jog and manual?
value 0 is off, 1=jog active (bit 0), 2=manual active (bit 1), 4,8,16, can be whatever.


Kalle

Edit: Normally I use set commands in the HMI and read, reset and store the commands in other bits 'early' in OB1.
 
Last edited:
Hi Kalle,

I initially used the byte idea, then decided to change to bits to make it "easier", but that would work.

So you do exactly what I was thinking of doing, assign the HMI outputs with bits, then assign these bits to other bits at the beginning of OB1? That is how I was thinking of solving the problem, made perfect sense to me. However, I was told by a co-worker much more knowledgeable than I that this isn't the best way to to do it, without giving me a good explanation why I shouldn't do it this way.
 
The code in the pdf file would be fine (it's pretty much how I was doing it) if the jog button were an actual hardwired input and not an HMI button. The problem is that the button is linked to a data block bit, meaning it could change at any moment in the program, not just at the point that the plc reads the inputs. If in the off chance that the "jog button" bit changed between between those rungs, both manual mode and jog mode would be active at the same time. This is exactly the problem I'm trying to find a solution to.

sorry that sample had an error the second line first contact should be N.C. (examine off) making that change, If you look closely at the code I sent you you will see that it will not matter what the jog or manual "button" bits do once one has been selected. they are locked out of changing anything by the other function taking control. the only way to change the "Jog" or "manual" state would be to press a "stop" button or implement a stop condition, you only address the jog/manual bits in the first 2 lines of code, you use the latch bits to control the jog and manual sections of the program. works fine.
 
bits

sorry was busy sent wrong snippet the first time, no wonder you couldn't use it, here is corrected sample code, this does work and has been run on a s7-312 with no problems
 
this isn't the best way to to do it,

Maybe your colleague was trying to guide you into using a state sequence; It sounds like you are already discovering some of the difficulties encountered when not using a state sequence. A state sequence can be programmed in ladder logic quite easily and should only allow one state to exist in any one program scan. Search the forum and you should find descriptions and examples.

The HMIs operate as master where the communications are concerned in that they request data from the PLC and the PLC responds. In the other direction data is sent to the PLC but I don't know whether the data update is acyclic or not. As Kalle mentioned, it is good practice to set a bit from the HMI then have the PLC reset the bit once it has been processed in the code.

Nick

Edit: you should also be aware that, by default, HMI tags are only updated when they are displayed on a screen. This can be altered in the tag definition.
 
Last edited:
Thanks everyone for the responses.

Manglemender, why is it good practice to set bits in the HMI and then reset them when used in the program? By this do you mean set "bit 1" when button pressed, then assign "bit 1" directly to "bit 2" in an FC at the beginning of the scan cycle, while resetting "bit 1" in the same network? Then "bit 2" is used in the program as the button bit. Am I understanding this correctly, or am I totally off base here? I think I've asked this question with different wording now 3 times and am still unsure that I've gotten a completely clear answer. Could you maybe give an example of what you mean?

In my manual mode (buttons operated via the HMI) I've been using set while pressed with data block bits for solenoid valve operation, and my jog mode button (also on the HMI) I used a toggle bit when pressed. I've been trying to avoid using set/reset like the plague since it seems to trap me sometimes when randomly exiting a mode, where things don't get reset, but it seems like a lot of people on this board like set/reset for things like machine mode or state selection.

Thanks
 
Jieve:
I thinking that Manglemender is talking about something like this
exemple in Google apps
(just found google applications that need to be tested)


Yes... and no. The example given by the link is on the right track in that once the HMI button press has been used it is reset but it is used to set and reset an output which I don't like doing.

An example of what I meant was for example a reset button that might need to on for a second or two. Instead of using the set while pressed action I set the bit in the HMI and then the plc will reset it by means of a timer. This way of doing things also makes more sense when you start to write programs in a state sequence style where a bit doesn't need to remain set it just needs to trigger a transition from one state to another.

I don't have a problem using the "invert bit" function it's the "While Pressed" function that I try to avoid along with a combination of "Press =1 and Release =0" (depending on which HMI software you use). These functions rely on the release action of the button but some touch screen drivers timeout after a set time if your finger is not removed and your HMI software never gets the release action from the mouse driver.

Considder a scenario where you have speed increase and decrease buttons on a screen: Pressing speed increase starts the machine accelerating then when you reach the required speed you take your finger off the button but find that the machine continues to accelerate!

This thread discusses state transition at some length and post 26 has a simple example program.

http://www.plctalk.net/qanda/showthread.php?t=45009&highlight=state+transition

Nick
 

Similar Topics

Buona sera, Ho dei problemi nell' interfacciare PLC S5 con HMI 2a Gen. Siemens (ad esempio KTP400) tramite IBH Link S5++. il mio obbiettivo è solo...
Replies
0
Views
100
Siemens S7/TIA v18: "Remote" updates/bug fixes to PLC code & HMI screens..... Hi, The PLC application I'm working on will soon be delivered to...
Replies
5
Views
582
I'm a bit lost. I don't understand why my HMI (Simatic 1200) is not recognising any PLC tags. From the ethernet comms page , all seems OK. Yet...
Replies
15
Views
2,164
Sorry for the basic question: At the moment, the PLC [S7-1200] is connected to a laptop (contains TIA Portal) via the ethernet port. When I add...
Replies
10
Views
1,509
Hi Complete newcomer to S7 so go easy on me... Siemens S7: What cable do I need to connect S7-1200 PLC to HMI? The touch screen is one of these...
Replies
14
Views
2,611
Back
Top Bottom