Upgraded to 2.60 ~ now it won't read pin 5, 16F876A.


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2005
    Location
    Cocoa, Florida
    Posts
    42

    Default Upgraded to 2.60 ~ now it won't read pin 5, 16F876A.

    Here's an interesting one.
    Have 3 switches into a 16F876A; 10K pullups, 470pF slugs, active low.
    Pins are high on scope. Existing product, worked forever. Tried new PICs.

    After upgrading to 2.60, the PIC won't read one of the inputs, the PORTA.3.
    Wrote this below to find out why existing program cannot read a high on pin 5.
    Even driving from inside it doesn't see a high, but all other pins work as normal.
    It doesn't have to be debug, no way of reading this pin seems to work.

    Please tell me what I'm doing wrong.
    Ken

    Terminal output:

    PORTA.3: 0 (should be 1)
    PORTB.1: 1
    PORTA.4: 1


    Program:
    '************************************************* ***************
    'setup:

    DEFINE OSC 20 ' set the clock speed

    DEFINE DEBUG_REG PORTC ' Set Debug pin port
    DEFINE DEBUG_BIT 6 ' Set Debug pin bit
    DEFINE DEBUG_BAUD 9600 ' Set Debug baud rate
    DEFINE DEBUG_MODE 0 ' Set Debug mode: 0=true(inv), 1=TTL

    INCLUDE "modedefs.bas" ' must be in local directory

    INPUT PORTA.3 ' set input

    TRISA.3 = 1 ' set input (again)

    test:

    debug " PORTA.3: ", dec PORTA.3, 10, 13
    debug " PORTB.1: ", dec PORTB.1, 10, 13
    debug " PORTA.4: ", dec PORTA.4, 10, 13
    debug 10, 13
    pause 500

    goto test

    end

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: Upgraded to 2.60 ~ now it won't read pin 5, 16F876A.

    RA3 is analog by default until you disable it, and analog inputs read zero when trying to use as digital inputs.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Mar 2005
    Location
    Cocoa, Florida
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Upgraded to 2.60 ~ now it won't read pin 5, 16F876A.

    Bruce, once again you saved my bacon.
    The real mystery is how this input worked for the last three years... going back through the old code now.

    Thanks,
    Ken.

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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