I don't quite understand why you're doing this. If someone cuts off the pin, it is not going to grow back, right? So, you can simply read the state of the pin at the beginning every time such as:
DIR = PROG;
That's all you need (except configuring pins and enabling pull-ups).
This has an added advantage that if they do want to change the direction afterwards, they simply solder back the pin. It is much better for the people in the field than going through your complex "imprinting" procedure.
Sorry I don't think I explained the intention very well.
These control stepper motors which were not identically cabled, some will spin CW with DIR pin high, some CCW.
The pump, for its entire life must only spin CW, there is no need for it to spin CCW at all, ever.
Now, obviously the sensible answer is to reverse a winding, however this is a bit of a pig of a job on this machine, the terminals are 'well buried' so when the new uC is installed it's pretty much a 50/50 as to which way the motor will spin.
My thought (although I think I've coded it impossibly badly) was that the state of the direction pin (high or low) could be stored in EEPROM then adjusted during the start up cycle by simply physically holding a resistor to the programming pin and reversing the status of the direction pin until such a time the motor is changed or something else curious happens. This can then be left alone for years at a time and merrily run in the correct direction.
The bit about 'cutting the pin off' wasn't explained well by myself:
This is using an existing board where RB3 was never utilised and was just held low, I've installed the test uC's in a socket with the RB3 pin cut off (so the chip isn't damaged, just the socket) this breaks the connection between RB3 and ground that'd I'd have by just plugging the chip in.
You know, somehow, I think I've explained this in an even more complicated way!
Basically tech' can as an installation job restart with a resistor held to RB3 if the motor spins backwards on power up, DIR pin status is reversed, life goes on....
Does that make any more sense, or am I making this more obtuse!
Cheers,
Ed