Does anyone know what the state of the PORT pins are on a PIC when flashing the part? I am running a PIC 16F916 with an ICD3 programmer, and the IO pins are performing various functions, and need to understand what state they are in during programming when the PIC is energized.
1 Answer
In the datasheet for your microcontroller there are four tables, table 2-1 to 2-4, which describes all the registers, including PORTx
and TRISx
.
The tables have a column named Value on POR/BOR Reset and Value on all other Resets which describes the register state at startup and after resets.
As you can see for TRISA
up to and including TRISD
, the state is 1111 1111
, which means that the pins are configured as inputs, or in other words, put the corresponding output driver in a High-impedance mode.
Unless I'm completely mistaken, the programming mode should not change this, except for the pins relevant to programming.
-
\$\begingroup\$ Thanks. I am configuring the part to use the MCLR pin as an input so it is internally tied to VCC. I guess programming falls into the category of "all other resets?" \$\endgroup\$ Commented Jul 5, 2016 at 15:52
-
\$\begingroup\$ @JohnBirckhead I'm not familiar with the ICD3 which is why I had to "guard" my answer with "Unless I'm completely mistaken", but even if you can use the ICD3 to program the Flash without resetting the device, you must at least have the option of manually causing a reset before programming, if you want to make absolutely certain that the ports are tristated. \$\endgroup\$– pipeCommented Jul 5, 2016 at 16:01
-
\$\begingroup\$ I'm with you - I am just going to change the design to allow activation of MCLR. \$\endgroup\$ Commented Jul 5, 2016 at 16:09