How can I use RB7/PGD pin in PIC18F452

Discussion in 'Embedded Systems and Microcontrollers' started by raychar, May 29, 2012.

  1. raychar

    Thread Starter Member

    Nov 8, 2011
    82
    0
    In the program, I write this pin as output and with data output. It is reasonable that this function is not observed during debug mode using IDC2. However, after the program was programmed to IC, and running as standalone, this pin (RB7/PGD) still don't function.

    For pin RB6/PGC, it functions alright.

    Can anyone tell me what's problem this pin or mistake that I encounter?

    Thanks,
     
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    Typically I select a PIC with extra pins so I am able to leave the PGD & PGC pins free to do in circuit debugging with everything attached.

    That said, I don't see anything in the data sheet that would keep RB7 from functioning as general I/O beyond the basic Port, Latch, and Tris registers. The only 2 functions of that pin are RB7 and PGD, and you need 9.00 to 13.25 on MCLR to get the pin to work as PGD.
     
  3. raychar

    Thread Starter Member

    Nov 8, 2011
    82
    0
    I used to do as what you mentioned. However, this time, all other pins were used up, I need to used this RhB7/PGD pin as well. What is the meaning that it is I/O port or data line in debugging/programming in data sheet? I don't know why I can use it as a I/O port?

    Thanks,
     
  4. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    I don't see why you can not use it as a IO Port since it is a Digital IO plus an Interrupt on change pin...and you should also make sure the background debugger enable bit in the Configuration Register 4 Low is disabled (CONFIG4L bit 7).. maybe it is in your code.... you need to post a copy of the code so we can see what the issue is.....(make sure to use the code tags in the advanced editor).
     
    Last edited: Jun 1, 2012
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    Normally it is a standard I/O line and there is no reason I can see why it is not working for you without any additional set up, such as a conflict with an overriding analog function.

    When programming or debugging the pin is a data line. To enter that mode you need to bring MCLR to >9VDC, or have low voltage programming enables in the config word: that would give you a problem with RB5 also as that detects low voltage programming mode.

    Why it does not work is a mystery to me. Does it work in the simulator? Have you tried another chip in case that pin is fried?
     
  6. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    add this to your code and see if it helps...

    Code ( (Unknown Language)):
    1. __CONFIG _CONFIG4L, 0xFB
     
  7. raviypujar

    New Member

    May 20, 2012
    9
    2
    Hey check whether the pin is open drain, if so put a 10k ohm pull up to the pin and it should work. If its an open drain, even if you make it high you don't observe the voltage using multi meter . So put a pull up.


    -Ravi

    Embedded World
     
  8. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    A better way to check these things is to look it up in the manufacturer's data sheet.

    The manufacturer states the pin is a standard output pin, not open drain.
     
  9. raviypujar

    New Member

    May 20, 2012
    9
    2
    Yes check in the datasheet first



    -Ravi

    <SNIP>
     
    Last edited by a moderator: Jun 17, 2012
Loading...