Sharing PGD / RA0 and PGC / RA1?

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
I have chosen a 18F14K22 for my project. It multiplexes PGD / RA0 on on pin and PGC / RA1 on another.

I have gotten to the point of PCB design and it would help my PCB design immensely, if I can make use of these pins for I/O

Can I use these pins for I/O and still be able to debug my code? If so, what are the limitations? Would I for example need to set my TRIS bits every time for these pins? Or can I not use these pins for I/O and still debug?
 

mik3

Joined Feb 4, 2008
4,843
You can use them for both debug and I/O but you may be able to use them if you use PGD/PGC only for programming.
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
You can use them for both debug and I/O but you may be able to use them if you use PGD/PGC only for programming.
Thanks for answering.

Sorry mik3. I guess I am being dense. I do not fully understand.

Are you saying I can use RA0 and RA1 as I/O pins and the debugger will still work?

Would I need to have a jumper for programming?

Sorry I did not understand,. Can you clarify please?
 

mik3

Joined Feb 4, 2008
4,843
If you want to debig the PIC you cannot use RA0 and RA1 as I/O pins because the debuger needs them to send/receive data from the PIC. You may be able to use these pins as I/O if you use them only to program the PIC and then remove the programmer however you will need to change the congfiguration bits while the PIC is running (I am not sure if this is possible but I think it is). Also, you will need jumpers as to disconnect whatever is connected to RA0 and RA1 while the programming is in progress.
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
If you want to debig the PIC you cannot use RA0 and RA1 as I/O pins because the debuger needs them to send/receive data from the PIC. You may be able to use these pins as I/O if you use them only to program the PIC and then remove the programmer however you will need to change the congfiguration bits while the PIC is running (I am not sure if this is possible but I think it is). Also, you will need jumpers as to disconnect whatever is connected to RA0 and RA1 while the programming is in progress.
Thanks mik3. That is sort of what I suspected.

If in a jumper as you said, I could still debug, just not that part of of the circuit?



I suppose I could also place a header pin at one of my unused I/O pins and temporarily jump to them when debugging. Not ideal but I guess it would work.

FYI There do not seem to be any config for PGC and PGD, just MCLRE / RA3.
 
Last edited:

mik3

Joined Feb 4, 2008
4,843
Thanks mik3. That is sort of what I suspected.

If in a jumper as you said, I could still debug, just not that part of of the circuit?



I suppose I could also place a header pin at one of my unused I/O pins and temporarily jump to them when debugging. Not ideal but I guess it would work.

FYI There do not seem to be any config for PGC and PGD, just MCLRE / RA3.
If you have jumbers you will be able to debug.

In the datasheet it says you have to define the DEBUG configuration bit but I couldn't find it!

Why don't you use the extra I/O pins and want to use RA0 and RA1?
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
If you have jumbers you will be able to debug.

In the datasheet it says you have to define the DEBUG configuration bit but I couldn't find it!

Why don't you use the extra I/O pins and want to use RA0 and RA1?
Because of PCB design. It would make it a lot easier if I could use those pins. But if it is going to be a pain with debug then maybe I will forget them. :(.
 

mik3

Joined Feb 4, 2008
4,843
Because of PCB design. It would make it a lot easier if I could use those pins. But if it is going to be a pain with debug then maybe I will forget them. :(.
Making all this touble with jumpers I think it would be better to use other I/O pins.
 

t06afre

Joined May 11, 2009
5,934
Even if the PICKIT 2(and 3) are devices that offer very much. They are budget tools. It is not meant for for professional use, even if I guess many use them in such setting. In a more professional setting you would probably have used a In-Circuit Debugger. With a In-Circuit Debugger you can run the system with "live" data while still allowing relatively good debugging capabilities. Microchip have units such as ICD 3 and MPLAB REAL ICE PROBE KIT for In-Circuit Debugging/emulation.
 
Top