(1)| 8/12/2016 8:48 PM | |
|
Posts: 1 Rating:
|
Hello, I want some lights dimmed controlled with S7-1200
The analog output is connected to the input of the dimmer 1-10V I input: Bool %I12.6 Default tag table output: Int %QW132 Default tag table Can someone help me with the programming. ------------------------------------------------------------------------------------------ |
Last edited by: Min_Moderator at: 8/15/2016 9:11:20 AMNew subject after splitting |
|
| 8/15/2016 4:01 PM | |
|
Joined: 7/7/2010 Last visit: 12/23/2025 Posts: 16325 Rating:
|
You will use timers to detect short push and long push. IF ShortPressTimer time > short press time (maybe 0.25 sec?) then ShortPressTimer := true; ShortPressTimer_EN := false; END_IF; If LongPressTimer time > long press time (maybe 1.0 sec) then ShortPressTimer := false; LongPressTimer := true; LongPressTimer_EN := false; ELSE LongPressTimer := false; END_IF; // now we know which type of press is presented, act on the analog outputs based on current analog outputs (probably better to use a CASE statement here....) If out_DimmerValue > (27648/10) THEN dimmerNotOff := true; ELSIF out_DimmerValue < 27648 THEN dimmerNotOn := true; END_IF; IF ShortPressTimer AND dimmerNotOff THEN // we should turn it OFF out_DimmerValue := 27648 / 10 END_IF; IF ShortPressTimer AND dimmerNotOn THEN // we should turn it ON out_DimmerValue := 27648 END_IF; --- you need to figure out your dimmer outputs for long press by trial and error. Basically set an update timer to pulse your dimmer value up or down some prescribed amount, then clamp it to 27648/10 (1 volt) for low and 27648 (10 volt) for high. That will bump up the output pretty smoothly if you set the timer and value bump up/down to suit. This is untested, and likely to contain bugs. It however should show you the thought behind it.
|
|
science guy |
|
This contribution was helpful to
|
|
| 8/15/2016 4:51 PM | |
|
Posts: 5225 Rating:
|
Homework assignment? |
This contribution was helpful to
|
|
Follow us on