Siemens S7/TIA v18: Using a button press to Write to a DataLog...

Mas01

Member
Join Date
Oct 2020
Location
Leicester, England
Posts
1,109
Context: PLC= S7-1212C, HMI=KTP1200 Basic.

Hi,

The operator has reported that, from time-to-time, when he presses the "Generate Report" button on the HMI (for button properties, see pic), the datalog (CSV file) is not being updated with a new row of data. Most of the times it does work, but occasionally not.

At the moment, DataLogWrite is called when "TA_DB.Report_Button_Pressed" is TRUE (Network 45, see pic).

My question is: Is there a better way than the Normally-Open contact, to trigger the REQ input of the DataLogWrite?

e.g. Is it better to use the button's rising-edge signal for REQ?

Happy to expand on any of the above.

Any suggestions most welcome.

Thanks in advance.

Report Button Properties.png Report button pressed.png
 
Last edited:
Just a thought. Your button is configured to set a bit when pressed and reset when released; the problem with this approach is that if you press teh button and then slide your finger off the button, the "Reset Bit" is omitted. You would be better off using the "on Click" event to set the request to log and then have the PLC code reset the bit when the task is done.

Nick
 
Just a thought. Your button is configured to set a bit when pressed and reset when released; the problem with this approach is that if you press teh button and then slide your finger off the button, the "Reset Bit" is omitted. You would be better off using the "on Click" event to set the request to log and then have the PLC code reset the bit when the task is done.

Nick
Cheers - yes, you're right about the bit being Set when pressed & Reset when released (see pic of RELEASE properties attached).

I assumed that "on Click" was something to do with a mouse button click, so I didn't use that feature. I'll look into doing something like you suggested, thanks.

button RELEASE properties.png
 
Agree with Manglemender.
I would set a bit by the HMI.
In the PLC, when the HMI bit is set, increment a counter, set the REQ bit high, and reset the HMI bit (*).
Reset the REQ bit upon DONE or ERROR.
Display the counter on the HMI, and include the counter in the values to be logged.

*: This causes the REQ to be set by the rising edge of the HMI bit.
 
I assumed that "on Click" was something to do with a mouse button click, so I didn't use that feature.

A Click event is a press and a release.

The other potential problem with your original approach is that the button may pressed and released so fast that the PLC is not updated and that is the other reason to set a request bit and have the PLC deal with it. @Jespers suggestion of a count is also a great addition.

Nick
 

Similar Topics

Context: PLC= S7-1212C, HMI=KTP1200 Basic. Hi again, When the "REPORT" button is pressed (on a different screen), it takes the operator to the...
Replies
7
Views
666
General Question: The PLC and HMI that I've been working on (a laser measurement system) is soon to be transported to the site where it will be...
Replies
2
Views
700
Hi, I'm not sure how to do this... Basically, I want to restrict the user input values for this tag to be in the range 20.001 to 25.0. I...
Replies
17
Views
1,633
Can someone help me with this? I'm no good at SCL - virtually everything I've done so far has been ladder logic. The return value from the...
Replies
13
Views
1,107
Hi, Am I being daft (again)? I want to increment a tag (Integer) by 1 each time a button on the HMI is pressed. Before the button press, the...
Replies
22
Views
2,361
Back
Top Bottom