Rizwan M
I've programmed at least 30 of the?DS51K1.? As I said above - once the yellow wire is connected, it goes into a "listening" mode.? ?The next time a turnout command comes down the rails it does two things. 1) It sets the address to whatever was sent.? 2) it executes the command.? It won't hurt anything to send the open/close commands a couple of times before disconnecting the yellow wire, but it doesn't accomplish much either.? All it does is reprogram itself to the same address every time you send the command.
I think you are making your job a lot harder by trying to program the decoder inside of the switch machine.? Given the amount of time you have spent trying to debug this, I think it's time to remove the decoder, program it outside of the switch.? Test it by connecting to the switch with jumper wires before re-installation.
When you have a problem to solve, you need to remove as many variables as possible.?
By the way, you probably know this, but the photo, the mechanical switch link is not inserted into it's mating hole.? If you don't put that back in place the turnout will never change position.? Check both ends of the link.? ?(It's the silver wire that looks like an unbent paper clip.? It's in the lower right part of the photo.)
gs