Problem setting outputs on PIC18FJ53

Discussion in 'Embedded Systems and Microcontrollers' started by spinnaker, Nov 27, 2011.

  1. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    5,449
    1,598
    I am having issues setting outputs on a PIC18f26J53. I have done this on other PICs before so I am not sure what is going on.

    I wrote a little test program to test the problem:

    Code ( (Unknown Language)):
    1.  
    2. TRISA = 0;
    3. TRISB = 0;
    4. TRISC = 0;
    5.  
    6. while(1)
    7. {  
    8.     LATA=255;
    9.     LATB=255;
    10.     LATC=255;
    11.     delay_ms(10);
    12.     LATA=0;
    13.     LATB = 0;
    14.     LATC=0;
    15.     delay_ms(10);
    16. }
    17.  
    I can see all but the following Latch pins transitioning:

    PortA
    All pins seem to transition as expected.


    PortB
    RB7, RB6 (both expected since they are also PGC and PGD and my PICKit is still connected.

    RB5 (always measures high, debugger shows as high)

    PortC
    RC4,RC5,RC7 (always measures low, debugger shows 2 & 7 as low and 7 as high)


    This PIC is a bit strange that is has an Open Drain option. I have never used this before but I don't think it is on all of the effected pins and I think it is disabled.

    Can someone please take a look?

    http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en548696

    BTW I also have a 18F27J53 which is pretty much pin and feature compatible and I am getting the exact behavior of the 18F26J53. So it must be something in the setup of the chip.
     
    Last edited: Nov 27, 2011
  2. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    719
    ANCON1
    ADCON1
    UCON
    UCFG

    RC 4,5 are USB D+/D-
    You need to change UCON and UCFG as well as ADCON0/1

     
    Last edited: Nov 27, 2011
  3. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    5,449
    1,598
    Thanks for finding that. I will take a look. I was really concentrating on PortB since that involved the SPI bus.
     
Loading...