Pulling port high


Closed Thread
Results 1 to 5 of 5
  1. #1
    the_antique's Avatar
    the_antique Guest

    Default Pulling port high

    At this point I feel like a total idiot. I was debugging a very simple program for a 16F870. It appears that the reason the program would not work properly was that PORTC.4 was not going high when instructed. Removing all unessential parts of the code, I wrote High PORTC.4. When I checked for a high state on the appropriate pin, I found it to be low. I changed chips with the same result. I added High PORTC.5 and, of course, that pin went high while PORTC.4 remained low. Is there something special about PORTC.4 on this chip that I missed?

    My code follows:

    ADCON1 = 7
    TRISA.0 = 1
    TRISB = 0
    TRISC = 0
    HH VAR BYTE
    MM VAR BYTE
    SS VAR BYTE
    DD VAR BYTE
    N VAR BYTE
    D VAR BYTE
    H VAR BYTE
    I VAR BYTE
    T VAR BYTE
    Z VAR BYTE

    High PORTC.4
    High PORTC.5

    Any help will be greatly appreciated.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    As i remind thos baby PIC don't have any multiplexed stuff on PORTC so i'll bet on a messy contact or bad breadboard.

    i just hope your code is longer than this.. let's say
    Code:
    ADCON1 = 7
    TRISA.0 = 1
    TRISB = 0
    TRISC = 0
    HH VAR BYTE
    MM VAR BYTE
    SS VAR BYTE
    DD VAR BYTE
    N VAR BYTE
    D VAR BYTE
    H VAR BYTE
    I VAR BYTE
    T VAR BYTE
    Z VAR BYTE
    
    High PORTC.4
    High PORTC.5
    Here:
        Goto Here
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    the_antique's Avatar
    the_antique Guest


    Did you find this post helpful? Yes | No

    Default

    Yes, the whole code is a LOT longer. I just truncated it to the bare minimums (except the variable assignments). I still have no idea why that particular port doesn't behave as the others do.

  4. #4
    the_antique's Avatar
    the_antique Guest


    Did you find this post helpful? Yes | No

    Default

    Yep, I am truly an idiot. I was so concerned that, because I hadn't used the '870 before, I had missed some special feature. Instead the problem was in the circuit wiring with a pull-down attached to the pin.

  5. #5
    Join Date
    Oct 2005
    Location
    Pinckney, Michigan
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Some port pins on PIC's are an open-drain output, and need a pull-up resistor to "make" a high signal. RA4 on smaller PIC's in particular.

    This one has tripped me up before also.

    I havent used the '870, but you can check the "I/O pin diagrams" in the data sheet to determine which pins are "push/pull" (don't need a pull-up) and which are open-drain (need a pull-up).

Similar Threads

  1. SERIN MIDI out of Synch?
    By jncortes in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th June 2009, 20:08
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. confused problem with interrupt in a working program
    By illuminator4 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 14th November 2008, 17:01
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. sample code for M25P32
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th January 2007, 02:37

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts