What you want is a mapping from pins out to pins in. You need to make one of two assumptions here. a) for one pin out there are few pins in b) for one pin out there are an arbitrary number of pins in I'd guess "a" If so, I'd do this - don't use line "0" as an input. Now your eeprom data looks something like this 0x00 0x00 0x00 0x00 etc. Now, if most cables are sparse on the output end too (like an RS232 cable, fer instance) I'd store it this way: 0x00 an output pin # of 0 terminates the list so, for example, if it's wired out in 1 - 1 2,3 - 3 4 - 5,6 5 - 4 6 - 7,8 your data would be 1 1 0 2 3 0 3 3 0 4 5 6 0 5 4 0 6 7 8 0 0 You presumably will cycle through, turning one output pin on at a time. otherwise you've no way of telling if it's shorted, cross wired, etc. obviously you somehow have to float the other lines (weak pull ups).