![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]() |
|
![]() |
|
Thread Tools | Display Modes |
![]() |
#1 |
Member
![]() ![]() Join Date: May 2021
Location: Izmir
Posts: 177
|
TIAPortal HMI how to have a button change functions when a value is changed
Hello,
I am currently trying to control a motor in my plc. I've made a simple on/off button logic. And it works pretty well, when i press the button it changes the speed of the motor to 100 and when i press it again it changes it to 0. This is nice. I also created a text list for my button so whenever the Motor speed is at 0 my button says "Start" and whenever it is between 1 and 100 it says "Stop" And i wanted to put a I/O field in there so if i dont want to just start and stop i can just change my motor speed to a specific value. Now this works as well but the two of them doesnt work well together. Remeber those "Start", "Stop" texts? yeah it seems they are just for show. So if i open up the programme i see START because currently my motor speed is 0. So i just change the value from my I/O field to lets say 50. And my button now is saying STOP. That is nice aswell. If i press STOP what happens? it sets the speed to 100. Not ideal at all. But if i press STOP again it works. Because of my code. I've tried putting some comparators but it didnt work out. Instead made things worse |
![]() |
![]() |
#2 |
Lifetime Supporting Member
|
[Update: or is the HMI button a momentary i.e. it sends a 1 when you press it, then it sends a 0 when you release it?]
So when you press and release your HMI button, it sends a 1 to HMI_PMotor_Start_Button? And the next time it sends a 0? And the time after that it sends a 1 again? And when you enter a speed (e.g. 50) on the HMI, that number is passed to the PLC, and somehow the PLC turns on the motor to run at that speed? I don't see where you have that logic. How does HMI_PMotor_On set the speed to 100 when it becomes 1? How does HMI_PMotor_On set the speed to 0 when it becomes 0? What do you want to happen if you enter a 0 speed in the I/O field?
__________________
i) Take care of the bits, and the bytes will take care of themselves. ii) There is no software problem that cannot be solved with another layer of indirection. iii) Measurement is hard. iv) I solemnly swear that I am up to no good ![]() Last edited by drbitboy; January 16th, 2022 at 04:21 AM. |
![]() |
![]() |
#3 | |||||
Member
![]() ![]() Join Date: May 2021
Location: Izmir
Posts: 177
|
Quote:
Quote:
Quote:
Quote:
![]() Quote:
|
|||||
![]() |
![]() |
#4 | |
Member
![]() ![]() Join Date: May 2021
Location: Izmir
Posts: 177
|
Quote:
|
|
![]() |
![]() |
#5 |
Lifetime Supporting Member
|
You need to "turn off" M12.0 if your i/o field is changed to 0.
Use a comparator to check i/o filed = zero to create a pulse (eg. M12.3). Then use M12.3 to turn off M12.0 |
![]() |
![]() |
#6 |
Lifetime Supporting Member
|
HMI-PLC interactions are more reliable if they are "(HMI) set and forget:"
Caveats
__________________
i) Take care of the bits, and the bytes will take care of themselves. ii) There is no software problem that cannot be solved with another layer of indirection. iii) Measurement is hard. iv) I solemnly swear that I am up to no good ![]() Last edited by drbitboy; January 16th, 2022 at 12:59 PM. |
![]() |
![]() |
#7 |
Lifetime Supporting Member
|
__________________
i) Take care of the bits, and the bytes will take care of themselves. ii) There is no software problem that cannot be solved with another layer of indirection. iii) Measurement is hard. iv) I solemnly swear that I am up to no good ![]() |
![]() |
![]() |
#8 |
Lifetime Supporting Member + Moderator
|
Sometimes logic you create to do one thing gets in the way when you try to enhance it to do additional things. When that happens your best strategy may be to start over rather than modify. That may be the case here.
You have two commands, one to tell the motor to start, the other to tell it how fast to go. Most, if not all VFDs have two parameters for that purpose, one to specify the source of the run command (keypad, hard-wired terminals, network interface, etc), the other to specify the source of the speed command (keypad, hard-wired current or voltage, network interface, etc). Your logic should control the run command and the speed command separately, and include any interlocks between the two you feel are necessary. You may want to prevent setting a run command unless the speed command is greater than zero or cancel a run command already in place if the speed command is changed to zero. |
![]() |
![]() |
#9 | |
Member
![]() ![]() Join Date: May 2021
Location: Izmir
Posts: 177
|
Quote:
![]() |
|
![]() |
![]() |
#10 | ||
Member
![]() ![]() Join Date: May 2021
Location: Izmir
Posts: 177
|
Quote:
Quote:
![]() ![]() ![]() |
||
![]() |
![]() |
#11 |
Member
![]() ![]() Join Date: May 2021
Location: Izmir
Posts: 177
|
Oh and btw 1s debounce time is really long. Is there a specific reason for making it 1 second? I currently changed it to 1ms and it works without a problem. 1 second is already long and with the 100ms latency of the button press it feels like the programme is lagging.
|
![]() |
![]() |
#12 |
Lifetime Supporting Member
|
[QUOTE=Steve Bailey;905071]Sometimes logic you create to do one thing gets in the way when you try to enhance it to do additional things. ...
Your logic should control the run command and the speed command separately,.../QUOTE] +1 Well said! I found it easier to write the code to fix the problem than putting the problem into words.
__________________
i) Take care of the bits, and the bytes will take care of themselves. ii) There is no software problem that cannot be solved with another layer of indirection. iii) Measurement is hard. iv) I solemnly swear that I am up to no good ![]() |
![]() |
![]() |
#13 | |
Lifetime Supporting Member
|
Quote:
__________________
i) Take care of the bits, and the bytes will take care of themselves. ii) There is no software problem that cannot be solved with another layer of indirection. iii) Measurement is hard. iv) I solemnly swear that I am up to no good ![]() Last edited by drbitboy; January 16th, 2022 at 04:26 PM. |
|
![]() |
![]() |
#14 |
Member
![]() ![]() Join Date: May 2021
Location: Izmir
Posts: 177
|
I see, i understand now where you are coming from sir. Thank you so much for your valuable answer.
|
![]() |
![]() |
#15 |
Lifetime Supporting Member
|
Hmmm strange it worked for me in a simulator - maybe you could show what you did? Although I see you have it sorted now.
|
![]() |
![]() |
Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hung pushbutton on HMI | Jim G. | LIVE PLC Questions And Answers | 18 | December 18th, 2020 10:54 AM |
Advanced HMI Screen Change | Gadelric | LIVE PLC Questions And Answers | 1 | January 31st, 2020 05:24 PM |
GE 90-30 with Maple HMI (%M bit Mysteriously activated) | Hamwi89 | LIVE PLC Questions And Answers | 10 | April 18th, 2019 02:25 PM |
pallet pattern not possible to change from proface hmi. | Saudi jamal | LIVE PLC Questions And Answers | 1 | December 25th, 2018 03:54 PM |
pallet pattern not possible to change from proface hmi. | Saudi jamal | LIVE PLC Questions And Answers | 0 | December 25th, 2018 03:21 PM |