Yes I tried it with your last example. No improvement and no errors.
I thought about he same, that the computer clock is not stable.
Thanks a lot for your help. I talked to my boss and he said I should by the more expensive power supply with a build in pulse module, but let me know if you have another idea for the problem.
The other technique I'm thinking of consists of having two loops (two execution threads) where one thread is concerned with turning OFF the power supply and the other one to turn it ON. Each execution thread would be tied to a CPU core and a notifier would tell the other thread when it can execute. Each loop would execute one iteration and wait until the other loop sends a notification to proceed. The delay would be between sending the command to the instrument and before sending the notification.
It was a good idea and try with the duel core processor, but the problem is, that the computer on which the program should run has no duel core processor. Is there any other idea to provent this problem?