the portd.7 signal is a limit switch for max position of open window.He must disable opening,but if something goes wrong I will put a second hardware switch to disable motor.
On test board this routine works good.