PIC MCU 16F887 C.7 question

Discussion in 'Embedded Systems and Microcontrollers' started by Neosec, Mar 31, 2013.

  1. Neosec

    Thread Starter Member

    Feb 25, 2013
    36
    1
    I have LEDs on all port C pins and noticed that with the TRISC register set as inputs, %11111111, PORTC.7 is output high. Is this due to the serial function available on C.7? I'm guessing it defaults to On and setting something in RCSTA? or TXSTA? would stop the high output when set as an input.
    Noob question, I don't have experience with serial comm.

    TIA
     
    Last edited: Mar 31, 2013
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Why would you need to guess what the default setting is when the data sheet will tell you what it is?

    Also, if a pin defaulted to an input why would that pin appear as an output going high?

    (Not to be tough on you, but questions such as this you should learn to find the answers for yourself. I'm happy to help you find the good parts of data sheets, just don't expect me to read them for you.)
     
  3. Neosec

    Thread Starter Member

    Feb 25, 2013
    36
    1
    I understand. I'm quite new to PIC and the datasheets and don't always understand what I'm reading.
    Am I looking in the right area of the datasheet? The ENHANCED UNIVERSAL SYNCHRONOUS ASYNCHRONOUS RECEIVER TRANSMITTER (EUSART) feature?
    I set RCSTA = %00000000 disabling the serial port but C.7 is still high.
    Please direct me to the "Good parts of the data sheet" :D
     
  4. Neosec

    Thread Starter Member

    Feb 25, 2013
    36
    1
    Found the Problem!!! It's my EasyPIC3 Board! I removed the PIC 16F887 and C7 LED Stayed on!!!

    What really helped was that the experienced people here didn't have a simple - Look dummy - answer. Not having a quick answer quickly helped solve the problem!

    Thank you all!!

    Neo
     
    Last edited: Mar 31, 2013
  5. Neosec

    Thread Starter Member

    Feb 25, 2013
    36
    1
    Ok, here's a full rundown of what happened... All my fault of course, but perhaps some day someone else may have this issue or a similar one an be able to learn from my mistakes.
    The EasyPIC3 development board has jumper settings for an RS-232 interface. The pertinent one here is the RX choices of RB1, RB2, RC7. RC7 was jumpered of course. This was the first project I've worked on on this board over 18 pins on a PIC so it was never an issue before. When I first noticed the LED on I set PORTC.7 as an output and to low... LED off. All good. Then I set TRISC = %1111111 which had no effect. Right then I noticed the jumper on the RS232 port, removed it, still the LED stayed on so I discounted the jumper as a factor since it made no difference, assuming it was un-powered or floating. I only had 7 ones for the TRISC registed which caused the removal of the RS-232 jumper to have no effect! Since TRISC was set to %01111111.
    Removal of the RS-232 jumper and TRISC = %1111111 and RCSTA = %00000000 (neither of which were needed) and all's well.

    A typo and a missed jumper combined it just the right order to really complicate things.

    Thanks again

    Neo
     
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Hey glad you found it.

    As far as the "good parts" of the DS, for ports there is typically a table showing every register that can affect the port pins... it's where you learn if some analog function can take control (because it's on by default) of your digital pin.
     
Loading...