Electrical – ICSP CLK/DAT & the 2 buttons

icsppic

I have a PIC16F684 with buttons connected to PORTA:0 & PORTA:1 which are also used for ICSP DAT & CLK. The ICSP signals are coming from a PIC programmer which I've built using an Arduino. The DAT & CLK lines are driven by IO pins and I'm not sure of what to set the IO lines to so that they allow the buttons to be read by the PIC. I've enabled the weak pull-ups and buttons on other PORTA lines work fine. Should I use series resistors on the button lines? I've tried 180 ohms at points A & B but the signals are still being influenced by the ICSP lines. I've also tried 180 & 660 ohm resistors at C & D, still no luck.

So – how do I isolate the ICSP lines when the programmer is idle? I could use a FET but it seems like overkill…

schematic

simulate this circuit – Schematic created using CircuitLab

Best Answer

If I understand correctly, you want to support ICSP, and once the target is programmed, you want the buttons to function normally.

In that case, simply modify your Arduino programmer to set it's CLK and DAT lines as inputs, effectively removing them from the system. Now your target can set up it's inputs as it wants, which in this case is probably with pullups.