Hi at all, i solved finally my problems.
I followed the suggestion for dcutugno about one routine of initialiting. Then i putted inside this routine all the variables that point at segments interested and i give them the value 1. But only for the switches at 3 way (On-Off-On) and some switches that give the problems (some On-Off). Now works great !!!

Thanks at all.

Giuseppe Reda