Sharing PGD / RA0 and PGC / RA1?

Discussion in 'Embedded Systems and Microcontrollers' started by spinnaker, Feb 14, 2010.

  1. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,887
    1,014
    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?
     
  2. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    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.
     
  3. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,887
    1,014
    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?
     
  4. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    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.
     
  5. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,887
    1,014
    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: Feb 14, 2010
  6. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    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?
     
  7. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,887
    1,014
    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. :(.
     
  8. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Making all this touble with jumpers I think it would be better to use other I/O pins.
     
  9. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,887
    1,014
    Yeah figured the same. I am now redesigning everything. :)

    Note to self: Consider pin out locations when designing your schematic. :)
     
  10. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    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.
     
Loading...