I think you have right...
As Henrik says ,now the triac is triggered at the same phase angle in all cases.
I must change my code to put the pulse position in a variable.
Thanks all of you!
I will inform you about my progress!




BTW, take a look at the code,bacause I checked it many times and I could not find where the problem is.

http://www.picbasic.co.uk/forum/atta...0&d=1103787743

Thanks again,
Reven